Examples of ISDAYieldCurveAndHazardRateCurveProvider


Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

      hrDates[i] = HR_DATES[i].plusDays(12);
      hrTimes[i] = DAY_COUNT.getDayCountFraction(BASE_DATE, hrDates[i]);
    }
    final HazardRateCurve hazardRateCurve = new HazardRateCurve(hrDates, hrTimes, HR_RATES, OFFSET);
    CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(true).withMaturityDate(VALUATION_DATE.plusYears(50));
    final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(YIELD_CURVE, hazardRateCurve);
    ZonedDateTime startDate = getStartDate(cds);
    ZonedDateTime endDate = cds.getMaturityDate();
    double[] actual = CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, curves);
    double[] dep = DEPRECATED_CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, YIELD_CURVE, hazardRateCurve);
    int nActual = actual.length;
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

  public void testCDSWithinCurves() {
    CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(true)
        .withMaturityDate(YC_DATES[YC_DATES.length - 1].minusMonths(1))
        .withEffectiveDate(VALUATION_DATE.minusMonths(1).plusDays(1))
        .withStartDate(VALUATION_DATE.minusMonths(1));
    final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(YIELD_CURVE, HAZARD_RATE_CURVE);
    ZonedDateTime startDate = getStartDate(cds);
    ZonedDateTime endDate = cds.getMaturityDate();
    double[] actual = CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, CURVES);
    double[] dep = DEPRECATED_CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, YIELD_CURVE, HAZARD_RATE_CURVE);
    int nActual = actual.length;
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nullCurveTest() {
    final CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinition().withMaturityDate(VALUATION_DATE.plusYears(10));
    final ZonedDateTime startDate = getStartDate(cds);
    final ZonedDateTime endDate = cds.getMaturityDate();
    final ISDAYieldCurveAndHazardRateCurveProvider cv = null;
    CALCULATOR.constructCreditDefaultSwapContingentLegIntegrationSchedule(VALUATION_DATE, startDate, endDate, cds, cv);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

    // Modify the survival curve so that it has the modified vector of hazard rates as an input to the ctor
    final HazardRateCurve hazardRateCurve = new HazardRateCurve(tenors, tenorsAsDoubles, hazardRates, 0);

    // Compute the PV of the CDS with this term structure of hazard rates
    final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
    return PV_CALCULATOR.getPresentValue(calibrationCDS, curves, valuationDate, priceType);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void nullCurveTest() {
    final CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinition().withMaturityDate(VALUATION_DATE.plusYears(10));
    final ISDAYieldCurveAndHazardRateCurveProvider cv = null;
    CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, cv);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

    }
    for (int i = 0; i < hrDates.length; i++) {
      expected[i * 2 + 2] = hrDates[i];
    }
    CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(true).withMaturityDate(VALUATION_DATE.plusYears(50));
    final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(YIELD_CURVE, hazardRateCurve);
    ZonedDateTime[] actual = CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, curves);
    expected[0] = cds.getStartDate();
    expected[expected.length - 1] = cds.getMaturityDate().plusDays(1);
    assertDateArrayEquals(expected, actual);
    assertDateArrayEquals(expected, DEPRECATED_CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(VALUATION_DATE, cds, YIELD_CURVE, hazardRateCurve, false));
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

  public void testCDSWithinCurves() {
    CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(true)
        .withMaturityDate(YC_DATES[YC_DATES.length - 1].minusMonths(1))
        .withEffectiveDate(VALUATION_DATE.minusMonths(1).plusDays(1))
        .withStartDate(VALUATION_DATE.minusMonths(1));
    final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(YIELD_CURVE, HAZARD_RATE_CURVE);
    ZonedDateTime[] actual = CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(cds, CURVES);
    ZonedDateTime[] expected = new ZonedDateTime[YC_DATES.length + 1];
    for (int i = 0; i < YC_DATES.length; i++) {
      expected[i + 1] = YC_DATES[i];
    }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

      // Modify the survival curve so that it has the modified vector of hazard rates as an input to the ctor
      final HazardRateCurve hazardRateCurve = new HazardRateCurve(tenors, tenorsAsDoubles, hazardRates, 0);

      // Compute the PV of the CDS with this term structure of hazard rates
      final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
      return PV_CALCULATOR.getPresentValue(calibrationCDS, curves, _valuationDate, priceType);
    }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

    final double[] calibratedHazardRates = HAZARD_RATE_CALCULATOR.getCalibratedHazardRateTermStructure(valuationDate, cds, marketTenors,
        marketSpreads, yieldCurve, priceType);
    final double bumpedRecoveryRate = getBumpedRecoveryRate(cds, recoveryRateBump, recoveryRateBumpType);
    final HazardRateCurve calibratedHazardRateCurve = new HazardRateCurve(marketTenors, times, calibratedHazardRates, 0.0);
    final CreditDefaultSwapDefinition bumpedCDS = cds.withRecoveryRate(bumpedRecoveryRate);
    final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, calibratedHazardRateCurve);
    final double presentValue = CALCULATOR.getPresentValue(cds, curves, valuationDate, priceType);
    final double bumpedPresentValue = CALCULATOR.getPresentValue(bumpedCDS, curves, valuationDate, priceType);
    return bumpedPresentValue - presentValue;
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.ISDAYieldCurveAndHazardRateCurveProvider

    DATA_CHECKER.checkSpreadData(valuationDate, marketTenors, marketSpreads);
    final int nSpreads = marketSpreads.length;
    final double[] bucketedCS01 = new double[nSpreads];
    ISDAYieldCurveAndSpreadsProvider calibrationData = new ISDAYieldCurveAndSpreadsProvider(marketTenors, marketSpreads, yieldCurve);
    HazardRateCurve hazardRateCurve = HAZARD_RATE_CALCULATOR.calibrateHazardRateCurve(cds, calibrationData, valuationDate);
    ISDAYieldCurveAndHazardRateCurveProvider curveProvider = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
    final double presentValue = PV_CALCULATOR.getPresentValue(cds, curveProvider, valuationDate, priceType);
    // Loop through and bump each of the spreads at each tenor
    for (int m = 0; m < nSpreads; m++) {
      // Calculate the bumped spreads vector
      final double[] bumpedMarketSpreads = SPREAD_BUMPER.getBumpedCreditSpreads(marketSpreads, m, spreadBump, spreadBumpType);
      // Calculate the bumped CDS PV
      calibrationData = new ISDAYieldCurveAndSpreadsProvider(marketTenors, bumpedMarketSpreads, yieldCurve);
      hazardRateCurve = HAZARD_RATE_CALCULATOR.calibrateHazardRateCurve(cds, calibrationData, valuationDate);
      curveProvider = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
      final double bumpedPresentValue = PV_CALCULATOR.getPresentValue(cds, curveProvider, valuationDate, priceType);
      // Compute the CS01 for this tenor
      bucketedCS01[m] = (bumpedPresentValue - presentValue) / spreadBump;
    }
    return bucketedCS01;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.