Package com.opengamma.analytics.financial.credit.creditdefaultswap.definition.legacy

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.definition.legacy.LegacyCreditDefaultSwapDefinition


    final double[] tenorsAsDoubles = SCHEDULE_GENERATOR.convertTenorsToDoubles(marketTenors, valuationDate, DayCountFactory.INSTANCE.getDayCount("ACT/365"));

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

    // Create a calibration CDS object from the input CDS (maturity and contractual spread of this CDS will vary as we bootstrap up the hazard rate term structure)
    LegacyCreditDefaultSwapDefinition calibrationCDS = cds;

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

    // Loop through each of the input tenors
    for (int m = 0; m < marketTenors.length; m++) {

      // Construct a temporary vector of the first m tenors (note size of array)
      final ZonedDateTime[] runningTenors = new ZonedDateTime[m + 1];
      final double[] runningTenorsAsDoubles = new double[m + 1];

      // Construct a temporary vector of the hazard rates corresponding to the first m tenors (note size of array)
      final double[] runningHazardRates = new double[m + 1];

      // Populate these vector with the first m tenors (needed to construct the survival curve using these tenors)
      for (int i = 0; i <= m; i++) {
        runningTenors[i] = marketTenors[i];
        runningTenorsAsDoubles[i] = tenorsAsDoubles[i];
        runningHazardRates[i] = hazardRates[i];
      }

      // Modify the calibration CDS to have a maturity of tenor[m]
      calibrationCDS = (LegacyCreditDefaultSwapDefinition) calibrationCDS.withMaturityDate(marketTenors[m]);

      // Modify the calibration CDS to have a contractual spread of marketSpread[m]
      calibrationCDS = calibrationCDS.withSpread(marketSpreads[m]);

      // Compute the calibrated hazard rate for tenor[m] (using the calibrated hazard rates for tenors 1, ..., m - 1)
      hazardRates[m] = calibrateHazardRate(valuationDate, calibrationCDS, yieldCurve, runningTenors, runningTenorsAsDoubles, runningHazardRates, priceType);
    }
View Full Code Here


    final double[] tenorsAsDoubles = SCHEDULE_GENERATOR.convertTenorsToDoubles(marketTenors, valuationDate, DayCountFactory.INSTANCE.getDayCount("ACT/365"));

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

    // Create a calibration CDS object from the input CDS (maturity and contractual spread of this CDS will vary as we bootstrap up the hazard rate term structure)
    LegacyCreditDefaultSwapDefinition calibrationCDS = cds;

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

    // Loop through each of the input tenors
    for (int m = 0; m < marketTenors.length; m++) {

      // Construct a temporary vector of the first m tenors (note size of array)
      final ZonedDateTime[] runningTenors = new ZonedDateTime[m + 1];
      final double[] runningTenorsAsDoubles = new double[m + 1];

      final double[] runningHazardRates = new double[m + 1];

      // Populate this vector with the first m tenors (needed to construct the survival curve using these tenors)
      for (int i = 0; i <= m; i++) {
        runningTenors[i] = marketTenors[i];
        runningTenorsAsDoubles[i] = tenorsAsDoubles[i];
        runningHazardRates[i] = hazardRates[i];
      }

      // Modify the calibration CDS to have a maturity of tenor[m]
      calibrationCDS = (LegacyCreditDefaultSwapDefinition) calibrationCDS.withMaturityDate(marketTenors[m]);

      // Modify the calibration CDS to have a contractual spread of marketSpread[m]
      calibrationCDS = calibrationCDS.withSpread(marketSpreads[m]);

      // Compute the calibrated hazard rate for tenor[m] (using the calibrated hazard rates for tenors 1, ..., m - 1)
      hazardRates[m] = calibrateHazardRate(valuationDate, calibrationCDS, yieldCurve, runningTenors, runningTenorsAsDoubles, runningHazardRates, priceType);
    }
View Full Code Here

    double[] cs01Values;
    if (definition instanceof StandardCreditDefaultSwapDefinition) {
      StandardCreditDefaultSwapDefinition cds = (StandardCreditDefaultSwapDefinition) definition;
      cs01Values = CALCULATOR.bucketedCS01FromCreditCurve(analytic, getCoupon(definition), buckets, yieldCurve, hazardCurve, bump);
    } else if (definition instanceof LegacyCreditDefaultSwapDefinition) {
      LegacyCreditDefaultSwapDefinition cds = (LegacyCreditDefaultSwapDefinition) definition;
      cs01Values = CALCULATOR.bucketedCS01FromCreditCurve(analytic, getCoupon(definition), buckets, yieldCurve, hazardCurve, bump);
    } else {
      throw new OpenGammaRuntimeException("Unknown cds type " + definition.getClass().getSimpleName());
    }
    final int n = times.length;
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.credit.creditdefaultswap.definition.legacy.LegacyCreditDefaultSwapDefinition

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.