Skip to content

Commit

Permalink
Features:
Browse files Browse the repository at this point in the history
Bug Fixes/Re-organization:

	- Service Product Credit Index - Horizon Change Attribution #1 (1, 2, 3)
	- Service Product Credit Index - Horizon Change Attribution #2 (4, 5, 6)
	- Service Product Credit Index - Horizon Change Attribution #3 (7, 8, 9)
	- Service Product Credit Index - Horizon Change Attribution #4 (10, 11, 12)
	- Service Product Credit Index - Stubs #1 (13, 14, 15)
	- Service Product Credit Index - Stubs #2 (16, 17)
	- Service Product Credit Index - Stubs #3 (18, 19)
	- Service Product Fixed Bond API (20, 21, 22)
	- Service Product Fixed Bond API - Valuation Metrics #1 (23, 24, 25)
	- Service Product Fixed Bond API - Valuation Metrics #2 (26, 27, 28)
	- Service Product Fixed Bond API - Valuation Metrics #3 (29, 30, 31)
	- Service Product Fixed Bond API - Valuation Metrics #4 (32, 33, 34)
	- Service Product Fixed Bond API - Valuation Metrics #5 (35, 36, 37)
	- Service Product Fixed Bond API - Key Rate Duration #1 (38, 39)
	- Service Product Fixed Bond API - Key Rate Duration #2 (40, 41, 42)
	- Service Product Fixed Bond API - Key Rate Duration #3 (43, 44, 45)
	- Service Product Fixed Bond API - Key Rate Duration #4 (46, 47, 48)
	- Service Product Fixed Bond API - Key Rate Duration #5 (49, 50, 51)
	- Service Product Fixed Bond API - Key Rate Duration #6 (52, 53, 54)
	- Service Product Fixed Bond API - Key Rate Duration #7 (55, 56, 57)
	- Service Product Fixed Bond API - Horizon Change Attribution #1 (58, 59, 60)
	- Service Product Fixed Bond API - Horizon Change Attribution #2 (61, 62, 63)
	- Service Product Fixed Bond API - Horizon Change Attribution #3 (64, 65, 66)
	- Service Product Fixed Bond API - Horizon Change Attribution #4 (67, 68)
	- Service Product Fixed Bond API - Horizon Change Attribution #5 (69, 70)
	- Service Product Fixed Bond API - Relative Value Metrics #1 (71, 72)
	- Service Product Fixed Bond API - Relative Value Metrics #2 (73, 74, 75)
	- Service Product Fixed Bond API - Relative Value Metrics #3 (76, 77, 78)
	- Service Product Fixed Bond API - Relative Value Metrics #4 (79, 80, 81)
	- Service Product Fixed Bond API - Relative Value Metrics #5 (82, 83, 84)
	- Service Product Fixed Bond API - Relative Value Metrics #6 (85, 86)
	- Service Product Fixed Bond API - Stubs #1 (87, 88)
	- Service Product Fixed Bond API - Stubs #2 (89, 90)
	- Service Product Fixed Float API (91, 92, 93)
	- Service Product Fixed Float API - Horizon Change Attribution #1 (94, 95, 96)
	- Service Product Fixed Float API - Horizon Change Attribution #2 (97, 98, 99)
	- Service Product Fixed Float API - Horizon Change Attribution #3 (100, 101, 102)
	- Service Product Fixed Float API - Horizon Change Attribution #4 (103, 104, 105)
	- Service Product Fixed Float API - Horizon Change Attribution #5 (106, 107, 108)
	- Service Product Fixed Float API - Horizon Change Attribution #6 (109, 110, 111)
	- Service Product Fixed Float API - Horizon Change Attribution #7 (112, 113)
	- Service Product Fixed Float API - Horizon Change Attribution #8 (114, 115)
	- Service Product Fixed Float API - Stubs (116, 117, 118)
	- Service Product Funding Futures API (119, 120)


Samples:

IdeaDRIP:
  • Loading branch information
Lakshmik committed Dec 24, 2024
1 parent 8554726 commit bbb4094
Show file tree
Hide file tree
Showing 5 changed files with 1,217 additions and 702 deletions.
54 changes: 54 additions & 0 deletions ReleaseNotes/04_24_2024.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

Features:

Bug Fixes/Re-organization:

- Service Product Credit Index - Horizon Change Attribution #1 (1, 2, 3)
- Service Product Credit Index - Horizon Change Attribution #2 (4, 5, 6)
- Service Product Credit Index - Horizon Change Attribution #3 (7, 8, 9)
- Service Product Credit Index - Horizon Change Attribution #4 (10, 11, 12)
- Service Product Credit Index - Stubs #1 (13, 14, 15)
- Service Product Credit Index - Stubs #2 (16, 17)
- Service Product Credit Index - Stubs #3 (18, 19)
- Service Product Fixed Bond API (20, 21, 22)
- Service Product Fixed Bond API - Valuation Metrics #1 (23, 24, 25)
- Service Product Fixed Bond API - Valuation Metrics #2 (26, 27, 28)
- Service Product Fixed Bond API - Valuation Metrics #3 (29, 30, 31)
- Service Product Fixed Bond API - Valuation Metrics #4 (32, 33, 34)
- Service Product Fixed Bond API - Valuation Metrics #5 (35, 36, 37)
- Service Product Fixed Bond API - Key Rate Duration #1 (38, 39)
- Service Product Fixed Bond API - Key Rate Duration #2 (40, 41, 42)
- Service Product Fixed Bond API - Key Rate Duration #3 (43, 44, 45)
- Service Product Fixed Bond API - Key Rate Duration #4 (46, 47, 48)
- Service Product Fixed Bond API - Key Rate Duration #5 (49, 50, 51)
- Service Product Fixed Bond API - Key Rate Duration #6 (52, 53, 54)
- Service Product Fixed Bond API - Key Rate Duration #7 (55, 56, 57)
- Service Product Fixed Bond API - Horizon Change Attribution #1 (58, 59, 60)
- Service Product Fixed Bond API - Horizon Change Attribution #2 (61, 62, 63)
- Service Product Fixed Bond API - Horizon Change Attribution #3 (64, 65, 66)
- Service Product Fixed Bond API - Horizon Change Attribution #4 (67, 68)
- Service Product Fixed Bond API - Horizon Change Attribution #5 (69, 70)
- Service Product Fixed Bond API - Relative Value Metrics #1 (71, 72)
- Service Product Fixed Bond API - Relative Value Metrics #2 (73, 74, 75)
- Service Product Fixed Bond API - Relative Value Metrics #3 (76, 77, 78)
- Service Product Fixed Bond API - Relative Value Metrics #4 (79, 80, 81)
- Service Product Fixed Bond API - Relative Value Metrics #5 (82, 83, 84)
- Service Product Fixed Bond API - Relative Value Metrics #6 (85, 86)
- Service Product Fixed Bond API - Stubs #1 (87, 88)
- Service Product Fixed Bond API - Stubs #2 (89, 90)
- Service Product Fixed Float API (91, 92, 93)
- Service Product Fixed Float API - Horizon Change Attribution #1 (94, 95, 96)
- Service Product Fixed Float API - Horizon Change Attribution #2 (97, 98, 99)
- Service Product Fixed Float API - Horizon Change Attribution #3 (100, 101, 102)
- Service Product Fixed Float API - Horizon Change Attribution #4 (103, 104, 105)
- Service Product Fixed Float API - Horizon Change Attribution #5 (106, 107, 108)
- Service Product Fixed Float API - Horizon Change Attribution #6 (109, 110, 111)
- Service Product Fixed Float API - Horizon Change Attribution #7 (112, 113)
- Service Product Fixed Float API - Horizon Change Attribution #8 (114, 115)
- Service Product Fixed Float API - Stubs (116, 117, 118)
- Service Product Funding Futures API (119, 120)


Samples:

IdeaDRIP:
166 changes: 105 additions & 61 deletions src/main/java/org/drip/service/product/CreditIndexAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.drip.param.market.CurveSurfaceQuoteContainer;
import org.drip.param.valuation.ValuationParams;
import org.drip.product.definition.CreditDefaultSwap;
import org.drip.service.template.LatentMarketStateBuilder;
import org.drip.state.credit.CreditCurve;
import org.drip.state.discount.DiscountCurve;
import org.drip.state.discount.MergedDiscountForwardCurve;
Expand Down Expand Up @@ -104,7 +105,15 @@
* provides the following Functionality:
*
* <ul>
* <li>Encode a list into JSON text and write it to out.</li>
* <li>Implementation of <i>ParCDS</i> Inner Class</li>
* <ul>
* <li><i>ParCDS</i> Constructor</li>
* <li>Retrieve the Fair Premium</li>
* <li>Retrieve the Fixed Coupon</li>
* <li>Retrieve the CDS Instance</li>
* </ul>
* <li>Generate the CDS Horizon Change Attribution</li>
* <li>Generate the Funding/Credit Curve Horizon Metrics</li>
* </ul>
*
* <br>
Expand Down Expand Up @@ -456,82 +465,117 @@ public static final PositionChangeComponents HorizonChangeAttribution (
/**
* 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 afullCreditIndexName Array of the Full Credit Index Names
* @param adblCreditIndexQuotedSpread Array of the Quoted Spreads
* @param spotDateArray Array of Spot
* @param horizonGap The Horizon Gap
* @param fundingFixingMaturityTenorArray Array of Funding Fixing Maturity Tenors
* @param fundingFixingQuoteGrid Double Array of Funding Fixing Swap Rates
* @param fullCreditIndexNameArray Array of the Full Credit Index Names
* @param creditIndexQuotedSpreadArray Array of the Quoted Spreads
*
* @return The Funding/Credit Curve Horizon Metrics
*/

public static final List<PositionChangeComponents>
HorizonChangeAttribution (
final JulianDate[] adtSpot,
final int iHorizonGap,
final String[] astrFundingFixingMaturityTenor,
final double[][] aadblFundingFixingQuote,
final String[] afullCreditIndexName,
final double[] adblCreditIndexQuotedSpread)
public static final List<PositionChangeComponents> HorizonChangeAttribution (
final JulianDate[] spotDateArray,
final int horizonGap,
final String[] fundingFixingMaturityTenorArray,
final double[][] fundingFixingQuoteGrid,
final String[] fullCreditIndexNameArray,
final double[] creditIndexQuotedSpreadArray)
{
if (null == adtSpot || 0 >= iHorizonGap || null == astrFundingFixingMaturityTenor || null ==
aadblFundingFixingQuote || null == afullCreditIndexName || null ==
adblCreditIndexQuotedSpread)
if (null == spotDateArray || 0 == spotDateArray.length ||
0 >= horizonGap ||
null == fundingFixingMaturityTenorArray || 0 == fundingFixingMaturityTenorArray.length ||
null == fundingFixingQuoteGrid ||
null == fullCreditIndexNameArray ||
null == creditIndexQuotedSpreadArray)
{
return null;
}

int iNumClose = adtSpot.length;
int iNumFundingInstrument = astrFundingFixingMaturityTenor.length;

List<PositionChangeComponents> lsPCC = new
ArrayList<PositionChangeComponents>();
List<PositionChangeComponents> positionChangeComponentsList =
new ArrayList<PositionChangeComponents>();

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;
for (int spotDateIndex = horizonGap; spotDateIndex < spotDateArray.length; ++spotDateIndex) {
int secondFundingQuoteCount = null == fundingFixingQuoteGrid[spotDateIndex] ? 0 :
fundingFixingQuoteGrid[spotDateIndex].length;
int firstFundingQuoteCount = null == fundingFixingQuoteGrid[spotDateIndex - horizonGap] ? 0 :
fundingFixingQuoteGrid[spotDateIndex - horizonGap].length;

if (0 == iNumFirstFundingQuote || iNumFirstFundingQuote != iNumFundingInstrument || 0 ==
iNumSecondFundingQuote || iNumSecondFundingQuote != iNumFundingInstrument)
if (0 == firstFundingQuoteCount ||
firstFundingQuoteCount != fundingFixingMaturityTenorArray.length ||
0 == secondFundingQuoteCount ||
secondFundingQuoteCount != fundingFixingMaturityTenorArray.length)
{
continue;
}

CreditIndexConvention cic =
CreditIndexConventionContainer.ConventionFromFullName
(afullCreditIndexName[i]);

if (null == cic) return null;
CreditIndexConvention creditIndexConvention =
CreditIndexConventionContainer.ConventionFromFullName (
fullCreditIndexNameArray[spotDateIndex]
);

String currency = cic.currency();
if (null == creditIndexConvention) {
return null;
}

CreditDefaultSwap cdsIndex = cic.indexCDS();
String currency = creditIndexConvention.currency();

MergedDiscountForwardCurve dcFundingFixingFirst =
org.drip.service.template.LatentMarketStateBuilder.FundingCurve (adtSpot[i - iHorizonGap],
currency, null, null, "ForwardRate", null, "ForwardRate",
astrFundingFixingMaturityTenor, aadblFundingFixingQuote[i - iHorizonGap], "SwapRate",
org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING);
CreditDefaultSwap cdsIndex = creditIndexConvention.indexCDS();

CreditCurve firstCreditCurve =
org.drip.service.template.LatentMarketStateBuilder.CreditCurve (adtSpot[i - iHorizonGap], new
CreditDefaultSwap[] {cdsIndex}, new double[]
{adblCreditIndexQuotedSpread[i - iHorizonGap]}, "FairPremium", dcFundingFixingFirst);

MergedDiscountForwardCurve dcFundingFixingSecond =
org.drip.service.template.LatentMarketStateBuilder.FundingCurve (adtSpot[i], currency,
null, null, "ForwardRate", null, "ForwardRate", astrFundingFixingMaturityTenor,
aadblFundingFixingQuote[i], "SwapRate",
org.drip.service.template.LatentMarketStateBuilder.SHAPE_PRESERVING);

CreditCurve secondCreditCurve =
org.drip.service.template.LatentMarketStateBuilder.CreditCurve (adtSpot[i], new
CreditDefaultSwap[] {cdsIndex}, new double[]
{adblCreditIndexQuotedSpread[i]}, "FairPremium", dcFundingFixingSecond);

lsPCC.add (HorizonChangeAttribution (dcFundingFixingFirst, firstCreditCurve, dcFundingFixingSecond,
secondCreditCurve, afullCreditIndexName[i]));
MergedDiscountForwardCurve firstFundingFixingDiscountCurve =
LatentMarketStateBuilder.FundingCurve (
spotDateArray[spotDateIndex - horizonGap],
currency,
null,
null,
"ForwardRate",
null,
"ForwardRate",
fundingFixingMaturityTenorArray,
fundingFixingQuoteGrid[spotDateIndex - horizonGap],
"SwapRate",
LatentMarketStateBuilder.SHAPE_PRESERVING
);

MergedDiscountForwardCurve secondFundingFixingDiscountCurve =
LatentMarketStateBuilder.FundingCurve (
spotDateArray[spotDateIndex],
currency,
null,
null,
"ForwardRate",
null,
"ForwardRate",
fundingFixingMaturityTenorArray,
fundingFixingQuoteGrid[spotDateIndex],
"SwapRate",
LatentMarketStateBuilder.SHAPE_PRESERVING
);

positionChangeComponentsList.add (
HorizonChangeAttribution (
firstFundingFixingDiscountCurve,
LatentMarketStateBuilder.CreditCurve (
spotDateArray[spotDateIndex - horizonGap],
new CreditDefaultSwap[] {cdsIndex},
new double[] {creditIndexQuotedSpreadArray[spotDateIndex - horizonGap]},
"FairPremium",
firstFundingFixingDiscountCurve
),
secondFundingFixingDiscountCurve,
LatentMarketStateBuilder.CreditCurve (
spotDateArray[spotDateIndex],
new CreditDefaultSwap[] {cdsIndex},
new double[] {creditIndexQuotedSpreadArray[spotDateIndex]},
"FairPremium",
secondFundingFixingDiscountCurve
),
fullCreditIndexNameArray[spotDateIndex]
)
);
}

return lsPCC;
return positionChangeComponentsList;
}
}
Loading

0 comments on commit bbb4094

Please sign in to comment.