Package com.opengamma.analytics.financial.credit.hazardratecurve

Examples of com.opengamma.analytics.financial.credit.hazardratecurve.HazardRateCurve


    // Put the hazard rate guess into the vector of hazard rates as the last element in the array
    hazardRates[numberOfTenors - 1] = hazardRateMidPoint;

    // 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


    final double[] hrTimes = new double[HR_TIMES.length];
    for (int i = 0; i < HR_DATES.length; i++) {
      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);
View Full Code Here

      for (int m = 1; m < modifiedHazardRateCurve.length; m++) {
        times[m] = ACT_365.getDayCountFraction(_valuationDate, marketDates[m - 1]);
        modifiedHazardRateCurve[m] = calibratedHazardRates[m - 1];
      }
      // Build a hazard rate curve object based on the input market data
      return new HazardRateCurve(marketDates, times, modifiedHazardRateCurve, 0.0);
    }
View Full Code Here

      // Put the hazard rate guess into the vector of hazard rates as the last element in the array
      hazardRates[numberOfTenors - 1] = hazardRateMidPoint;

      // 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

    final double[] hrTimes = new double[HR_TIMES.length];
    for (int i = 0; i < HR_DATES.length; i++) {
      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);
    final ZonedDateTime[] expected = new ZonedDateTime[hrDates.length + YC_DATES.length + 2];
    for (int i = 0; i < YC_DATES.length; i++) {
      expected[i * 2 + 1] = YC_DATES[i];
    }
    for (int i = 0; i < hrDates.length; i++) {
View Full Code Here

    }

    // ----------------------------------------------------------------------------------------------------------------------------------------

    // Construct a hazard rate term structure curve using the (calibrated) first m tenors in runningTenors
    final HazardRateCurve hazardRateCurve = new HazardRateCurve(marketTenors, runningTenors, hazardRates, 0.0);

    // ----------------------------------------------------------------------------------------------------------------------------------------

    // TODO : For testing purposes only - remember to take out
    final double temp = calculateCDSPV(valuationDate, calibrationCDS, marketTenors, runningTenors, hazardRates, hazardRateGuess, yieldCurve, hazardRateCurve, priceType);
View Full Code Here

    }

    // ----------------------------------------------------------------------------------------------------------------------------------------

    // Construct a hazard rate term structure curve using the (calibrated) first m tenors in runningTenors
    final HazardRateCurve hazardRateCurve = new HazardRateCurve(runningTenors, runningTenorsAsDoubles, hazardRates, 0.0);

    // ----------------------------------------------------------------------------------------------------------------------------------------

    // Now do the root search (in hazard rate space) - simple bisection method for the moment (guaranteed to work and we are not concerned with speed at the moment)
View Full Code Here

    public HazardRateCurve buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final List<ZonedDateTime> dates = (List<ZonedDateTime>) deserializer.fieldValueToObject(message.getByName(DATES_FIELD));
      final double[] times = deserializer.fieldValueToObject(double[].class, message.getByName(TIMES_FIELD));
      final double[] rates = deserializer.fieldValueToObject(double[].class, message.getByName(RATES_FIELD));
      final double offset = message.getDouble(OFFSET_FIELD);
      return new HazardRateCurve(dates.toArray(new ZonedDateTime[dates.size()]), times, rates, offset);
    }
View Full Code Here

    for (int j = 1; j < 15; j += 3) {
      for (int i = 0; i < len; i++) {
        hrDates[i] = HR_DATES[i].plusDays(j);
        hrTimes[i] = DAY_COUNT.getDayCountFraction(BASE_DATE, hrDates[i]);
      }
      final HazardRateCurve hazardRateCurve = new HazardRateCurve(hrDates, hrTimes, HR_RATES, OFFSET);

      ZonedDateTime[] res1 = CALCULATOR.constructCreditDefaultSwapAccruedLegIntegrationSchedule(VALUATION_DATE, cds1, YIELD_CURVE, hazardRateCurve, true);
      final ZonedDateTime[] expected = new ZonedDateTime[hrDates.length - 1 + YC_DATES.length - 1 + 2];
      for (int i = 0; i < YC_DATES.length - 1; i++) {
        expected[i * 2 + 1] = YC_DATES[i];
View Full Code Here

    }
  }

  @Test
  public void testAccLegWithFixedCurve() {
    final HazardRateCurve hrCurve = new HazardRateCurve(HR_DATES, HR_TIMES, HR_RATES, OFFSET);
    for (int j = 1; j < 15; j += 3) {
      for (int k = 1; k < 25; k += 4) {
        CreditDefaultSwapDefinition cds = CreditDefaultSwapDefinitionDataSets.getLegacyVanillaDefinitionWithProtectionStart(true)
            .withMaturityDate(YC_DATES[YC_DATES.length - 1].minusMonths(j))
            .withEffectiveDate(VALUATION_DATE.minusMonths(j).plusDays(k))
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.credit.hazardratecurve.HazardRateCurve

Copyright © 2018 www.massapicom. 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.