Berhampur.java
package org.drip.sample.securitysuite;
import org.drip.analytics.date.*;
import org.drip.analytics.daycount.*;
import org.drip.product.creator.BondBuilder;
import org.drip.product.credit.BondComponent;
import org.drip.service.env.EnvManager;
import org.drip.service.scenario.*;
/*
* -*- 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.
*/
/**
* Berhampur generates the Full Suite of Replication Metrics for Bond Berhampur.
*
* @author Lakshmi Krishnamurthy
*/
public class Berhampur {
public static final void main (
final String[] astArgs)
throws Exception
{
EnvManager.InitEnv ("");
JulianDate dtSpot = DateUtil.CreateFromYMD (
2017,
DateUtil.JULY,
10
);
String[] astrDepositTenor = new String[] {
"2D"
};
double[] adblDepositQuote = new double[] {
0.0130411 // 2D
};
double[] adblFuturesQuote = new double[] {
0.01345, // 98.655
0.01470, // 98.530
0.01575, // 98.425
0.01660, // 98.340
0.01745, // 98.255
0.01845 // 98.155
};
String[] astrFixFloatTenor = new String[] {
"02Y",
"03Y",
"04Y",
"05Y",
"06Y",
"07Y",
"08Y",
"09Y",
"10Y",
"11Y",
"12Y",
"15Y",
"20Y",
"25Y",
"30Y",
"40Y",
"50Y"
};
String[] astrGovvieTenor = new String[] {
"1Y",
"2Y",
"3Y",
"5Y",
"7Y",
"10Y",
"20Y",
"30Y"
};
double[] adblFixFloatQuote = new double[] {
0.016410, // 2Y
0.017863, // 3Y
0.019030, // 4Y
0.020035, // 5Y
0.020902, // 6Y
0.021660, // 7Y
0.022307, // 8Y
0.022879, // 9Y
0.023363, // 10Y
0.023820, // 11Y
0.024172, // 12Y
0.024934, // 15Y
0.025581, // 20Y
0.025906, // 25Y
0.025973, // 30Y
0.025838, // 40Y
0.025560 // 50Y
};
double[] adblGovvieYield = new double[] {
0.01219, // 1Y
0.01391, // 2Y
0.01590, // 3Y
0.01937, // 5Y
0.02200, // 7Y
0.02378, // 10Y
0.02677, // 20Y
0.02927 // 30Y
};
String[] astrCreditTenor = new String[] {
"06M",
"01Y",
"02Y",
"03Y",
"04Y",
"05Y",
"07Y",
"10Y"
};
double[] adblCreditQuote = new double[] {
60., // 6M
68., // 1Y
88., // 2Y
102., // 3Y
121., // 4Y
138., // 5Y
168., // 7Y
188. // 10Y
};
double dblFX = 1.;
int iSettleLag = 3;
int iFixedFreq = 2;
int iFloatFreq = 4;
String strName = "Berhampur";
double dblCleanPrice = 1.;
double dblIssuePrice = 1.;
String strCurrency = "USD";
double dblSpreadBump = 20.;
double dblFixedCoupon = 0.0625;
double dblIssueAmount = 3.6e08;
String strTreasuryCode = "UST";
String strFloatIndex = "USD-3M";
double dblFloatSpread = 0.03899;
String strFixedDayCount = "30/360";
double dblSpreadDurationMultiplier = 5.;
JulianDate dtEffective = DateUtil.CreateFromYMD (
2017,
DateUtil.FEBRUARY,
28
);
JulianDate dtFixedFirstCoupon = DateUtil.CreateFromYMD (
2017,
DateUtil.AUGUST,
28
);
JulianDate dtFixedPenultimateCoupon = DateUtil.CreateFromYMD (
2027,
DateUtil.FEBRUARY,
28
);
JulianDate dtFixedEnd = DateUtil.CreateFromYMD (
2027,
DateUtil.AUGUST,
28
);
JulianDate dtFloatFirstCoupon = DateUtil.CreateFromYMD (
2028,
DateUtil.FEBRUARY,
28
);
JulianDate dtFloatPenultimateCoupon = DateUtil.CreateFromYMD (
2056,
DateUtil.AUGUST,
28
);
JulianDate dtMaturity = DateUtil.CreateFromYMD (
2057,
DateUtil.FEBRUARY,
28
);
BondComponent bond = BondBuilder.FixedFPToFloatFP (
strName,
strName,
dtEffective.julian(),
dtFixedEnd.julian(),
dtFixedFirstCoupon.julian(),
dtFixedPenultimateCoupon.julian(),
iFixedFreq,
dblFixedCoupon,
strFixedDayCount,
strFixedDayCount,
dtMaturity.julian(),
dtFloatFirstCoupon.julian(),
dtFloatPenultimateCoupon.julian(),
iFloatFreq,
dblFloatSpread,
strFloatIndex,
new DateAdjustParams (
Convention.DATE_ROLL_FOLLOWING,
0,
strCurrency
),
null,
null,
null,
null,
null,
null,
null
);
BondReplicator abr = BondReplicator.CorporateSenior (
dblCleanPrice,
dblIssuePrice,
dblIssueAmount,
dtSpot,
astrDepositTenor,
adblDepositQuote,
adblFuturesQuote,
astrFixFloatTenor,
adblFixFloatQuote,
dblSpreadBump,
dblSpreadDurationMultiplier,
strTreasuryCode,
astrGovvieTenor,
adblGovvieYield,
astrCreditTenor,
adblCreditQuote,
dblFX,
Double.NaN,
iSettleLag,
bond
);
BondReplicationRun abrr = abr.generateRun();
System.out.println (abrr.display());
}
}