MunicipalFixedBullet1.java
package org.drip.sample.municipal;
import java.util.Map;
import org.drip.analytics.date.*;
import org.drip.analytics.output.BondRVMeasures;
import org.drip.analytics.support.Helper;
import org.drip.numerical.common.FormatUtil;
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.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) 2018 Lakshmi Krishnamurthy
* 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.
*/
/**
* MunicipalFixedBullet1 demonstrates Non-EOS Fixed Coupon Agency Bond Pricing and Relative Value Measure
* Generation Functionality.
*
* @author Lakshmi Krishnamurthy
*/
public class MunicipalFixedBullet1 {
private static final MergedDiscountForwardCurve FundingCurve (
final JulianDate dtSpot,
final String strCurrency)
throws Exception
{
String[] astrDepositMaturityTenor = new String[] {
"2D"
};
double[] adblDepositQuote = new double[] {
0.0111956 // 2D
};
double[] adblFuturesQuote = new double[] {
0.011375, // 98.8625
0.013350, // 98.6650
0.014800, // 98.5200
0.016450, // 98.3550
0.017850, // 98.2150
0.019300 // 98.0700
};
String[] astrFixFloatMaturityTenor = new String[] {
"02Y",
"03Y",
"04Y",
"05Y",
"06Y",
"07Y",
"08Y",
"09Y",
"10Y",
"11Y",
"12Y",
"15Y",
"20Y",
"25Y",
"30Y",
"40Y",
"50Y"
};
double[] adblFixFloatQuote = new double[] {
0.017029, // 2Y
0.019354, // 3Y
0.021044, // 4Y
0.022291, // 5Y
0.023240, // 6Y
0.024025, // 7Y
0.024683, // 8Y
0.025243, // 9Y
0.025720, // 10Y
0.026130, // 11Y
0.026495, // 12Y
0.027230, // 15Y
0.027855, // 20Y
0.028025, // 25Y
0.028028, // 30Y
0.027902, // 40Y
0.027655 // 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<String, GovvieCurve> 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<String, GovvieCurve> 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 (
0,
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) {
double dblCleanPriceOASUp = Double.NaN;
double dblCleanPriceOASDown = Double.NaN;
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 (aBond[i].accrued (dtSettle.julian(), csqc), 1, 5, 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 (aBond[i].weightedAverageLife (valParams, csqc), 2, 2, 1.) + " | " +
FormatUtil.FormatDouble (rvm.bondBasis(), 3, 0, 10000.) + " ||" + "\n";
adblOAS[i] = rvm.oas();
try {
dblCleanPriceOASUp = aBond[i].priceFromOAS (
valParams,
csqc,
null,
adblOAS[i] + 0.0001
);
dblCleanPriceOASDown = aBond[i].priceFromOAS (
valParams,
csqc,
null,
adblOAS[i] - 0.0001
);
} catch (Exception e) {
// e.printStackTrace();
}
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 | ACCRUED | YIELD | MAC DUR | MOD DUR | YIELD 01 | DV01 | CONV | WAL | BOND BASIS ||");
System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------------------------||");
System.out.print (strSecularMetrics);
System.out.println ("\t|----------------------------------------------------------------------------------------------------------------------------------------------------------------------||");
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.MARCH,
15
);
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.0104, // 1Y
0.0137, // 2Y
0.0167, // 3Y
0.0213, // 5Y
0.0243, // 7Y
0.0260, // 10Y
0.0294, // 20Y
0.0319 // 30Y
};
Map<String, GovvieCurve> 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 ("MUNICI ", DateUtil.CreateFromYMD (2011, 12, 20), DateUtil.CreateFromYMD (2021, 2, 1), 0.04400, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2011, 5, 11), DateUtil.CreateFromYMD (2022, 12, 1), 0.05210, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2009, 12, 10), DateUtil.CreateFromYMD (2025, 2, 1), 0.01180, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2012, 7, 30), DateUtil.CreateFromYMD (2025, 12, 15), 0.04676, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2011, 4, 12), DateUtil.CreateFromYMD (2026, 2, 1), 0.05400, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 12, 16), DateUtil.CreateFromYMD (2028, 3, 15), 0.06817, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2007, 6, 30), DateUtil.CreateFromYMD (2028, 6, 30), 0.05617, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 10, 28), DateUtil.CreateFromYMD (2029, 5, 1), 0.06645, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 12, 7), DateUtil.CreateFromYMD (2029, 9, 1), 0.06850, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 8, 26), DateUtil.CreateFromYMD (2031, 8, 1), 0.04500, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 2, 11), DateUtil.CreateFromYMD (2031, 11, 15), 0.06548, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 12, 22), DateUtil.CreateFromYMD (2032, 4, 1), 0.07099, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2012, 5, 3), DateUtil.CreateFromYMD (2034, 4, 1), 0.05900, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 2, 4), DateUtil.CreateFromYMD (2035, 2, 1), 0.06630, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 7, 21), DateUtil.CreateFromYMD (2035, 7, 1), 0.07350, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2011, 6, 15), DateUtil.CreateFromYMD (2037, 7, 1), 0.06352, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2009, 4, 30), DateUtil.CreateFromYMD (2039, 11, 15), 0.07336, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 6, 30), DateUtil.CreateFromYMD (2040, 3, 15), 0.05600, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 10, 14), DateUtil.CreateFromYMD (2040, 3, 15), 0.05389, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 2, 11), DateUtil.CreateFromYMD (2040, 6, 1), 0.07000, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 11, 30), DateUtil.CreateFromYMD (2040, 7, 1), 0.06790, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 11, 17), DateUtil.CreateFromYMD (2040, 7, 1), 0.07328, 2, "US MUNI: 30/360"),
Corporate ("MUNICI ", DateUtil.CreateFromYMD (2010, 12, 15), DateUtil.CreateFromYMD (2041, 1, 1), 0.07102, 2, "US MUNI: 30/360"),
};
double[] adblCleanPrice = new double[] {
1.0691325, // (2021, 2, 1)
1.1132945, // (2022, 12, 1)
0.8904175, // (2025, 2, 1)
1.0308015, // (2025, 12, 15)
1.1301335, // (2026, 2, 1)
1.2589000, // (2028, 3, 15)
1.1364350, // (2028, 6, 30)
1.1066300, // (2029, 5, 1)
1.1926305, // (2029, 9, 1)
1.1093100, // (2031, 8, 1)
1.2622500, // (2031, 11, 15)
1.3176500, // (2032, 4, 1)
1.0540000, // (2034, 4, 1)
0.9937500, // (2035, 2, 1)
1.0838400, // (2035, 7, 1)
1.1831155, // (2037, 7, 1)
1.4259900, // (2039, 11, 15)
1.2079250, // (2040, 3, 15)
1.1851900, // (2040, 3, 15)
1.2583300, // (2040, 6, 1)
1.2679600, // (2040, 7, 1)
1.2184495, // (2040, 7, 1)
1.3770600, // (2041, 1, 1)
};
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<String, GovvieCurve> 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<String, GovvieCurve> meGovvieCurve : mapGovvieCurve.entrySet()) {
if ("BASE".equalsIgnoreCase (meGovvieCurve.getKey()) || "BUMP".equalsIgnoreCase (meGovvieCurve.getKey()))
continue;
csqc.setGovvieState (meGovvieCurve.getValue());
String strDump = " | ";
try {
strDump = " | " +
FormatUtil.FormatDouble (
(adblCleanPrice[i] - aCorporateBond[i].priceFromOAS (
valParams,
csqc,
null,
adblOAS[i]
)) / adblCleanPrice[i],
2, 2, 10000.
) + " ";
} catch (Exception e) {
// e.printStackTrace();
}
System.out.print (strDump);
}
System.out.println (" ||");
}
System.out.println ("\t|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||");
System.out.println();
}
}