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

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


    ArgumentChecker.notNegative(spreadBump, "Spread bump");
    DATA_CHECKER.checkSpreadData(valuationDate, marketTenors, marketSpreads);
    final int nSpreads = marketSpreads.length;
    final double[] bucketedGammaCS01 = 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
View Full Code Here


    for (int m = 1; m < marketTenors.length; m++) {
      times[m] = ACT_365.getDayCountFraction(valuationDate, marketTenors[m]);
    }
    final double[] calibratedHazardRates = HAZARD_RATE_CALCULATOR.getCalibratedHazardRateTermStructure(valuationDate, cds, marketTenors,
        marketSpreads, yieldCurve, priceType);
    final HazardRateCurve calibratedHazardRateCurve = new HazardRateCurve(marketTenors, times, calibratedHazardRates, 0.0);
    final ISDAYieldCurveAndHazardRateCurveProvider curves = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, calibratedHazardRateCurve);
    final double presentValue = CALCULATOR.getPresentValue(cds, curves, valuationDate, priceType);
    final double lossGivenDefault = cds.getNotional() * (1 - cds.getRecoveryRate());
    double valueOnDefault = 0.0;
    if (cds.getBuySellProtection() == BuySellProtection.BUY) {
View Full Code Here

    ArgumentChecker.notNull(priceType, "price type");
    ArgumentChecker.notNegative(spreadBump, "Spread bump");
    DATA_CHECKER.checkSpreadData(valuationDate, marketTenors, marketSpreads);
    final double[] bumpedMarketSpreads = SPREAD_BUMPER.getBumpedCreditSpreads(marketSpreads, spreadBump, spreadBumpType);
    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);
    calibrationData = new ISDAYieldCurveAndSpreadsProvider(marketTenors, bumpedMarketSpreads, yieldCurve);
    hazardRateCurve = HAZARD_RATE_CALCULATOR.calibrateHazardRateCurve(cds, calibrationData, valuationDate);
    curveProvider = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
View Full Code Here

    final Double[] yields = yieldCurve.getCurve().getYData();
    final int nYields = yields.length;
    final double[] bumpedYields = new double[nYields];
    final double[] bucketedIR01 = new double[nYields];
    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);
    for (int i = 0; i < nYields; i++) {
      bumpedYields[i] = yields[i];
    }
View Full Code Here

    ArgumentChecker.notNull(yieldBumpType, "yield bump type");
    ArgumentChecker.notNull(priceType, "price type");
    ArgumentChecker.notNegative(yieldBump, "yield bump");
    DATA_CHECKER.checkSpreadData(valuationDate, marketTenors, marketSpreads);
    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);
    final Double[] yields = yieldCurve.getCurve().getYData();
    final int nYields = yields.length;
    final double[] bumpedYields = new double[nYields];
View Full Code Here

    ArgumentChecker.notNegative(spreadBump, "Spread bump");
    DATA_CHECKER.checkSpreadData(valuationDate, marketTenors, marketSpreads);
    final double[] bumpedUpMarketSpreads = SPREAD_BUMPER.getBumpedCreditSpreads(marketSpreads, spreadBump, spreadBumpType);
    final double[] bumpedDownMarketSpreads = SPREAD_BUMPER.getBumpedCreditSpreads(marketSpreads, -spreadBump, spreadBumpType);
    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);
    calibrationData = new ISDAYieldCurveAndSpreadsProvider(marketTenors, bumpedUpMarketSpreads, yieldCurve);
    hazardRateCurve = HAZARD_RATE_CALCULATOR.calibrateHazardRateCurve(cds, calibrationData, valuationDate);
    curveProvider = new ISDAYieldCurveAndHazardRateCurveProvider(yieldCurve, hazardRateCurve);
View Full Code Here

    final ValueProperties properties = Iterables.getOnlyElement(desiredValues).getConstraints().copy()
        .with(ValuePropertyNames.FUNCTION, getUniqueId())
        .get();
    final ISDAYieldCurveAndSpreadsProvider data = new ISDAYieldCurveAndSpreadsProvider(calibrationTimes.toArray(new ZonedDateTime[calibrationTimes.size()]),
        marketSpreads.toDoubleArray(), yieldCurve);
    final HazardRateCurve curve = CALCULATOR.calibrateHazardRateCurve(cdsOption.getUnderlyingCDS(), data, valuationTime);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.HAZARD_RATE_CURVE, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, curve));
  }
View Full Code Here

    // Calibrate the hazard rate curve to the market observed par CDS spreads (returns calibrated hazard rates as a vector of doubles)
    final double[] calibratedHazardRates = hazardRateCurve.getCalibratedHazardRateTermStructure(valuationDate, cds, marketTenors, marketSpreads, yieldCurve, PriceType.CLEAN);

    // Build a hazard rate curve object based on the input market data
    final HazardRateCurve calibratedHazardRateCurve = new HazardRateCurve(marketTenors, times, calibratedHazardRates, 0.0);

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

    // Create a CDS PV calculator
    final PresentValueLegacyCreditDefaultSwap creditDefaultSwap = new PresentValueLegacyCreditDefaultSwap();
View Full Code Here

    if (hazardRateCurveObject == null) {
      throw new OpenGammaRuntimeException("Could not get hazard rate curve");
    }
    final ISDADateCurve yieldCurve = (ISDADateCurve) yieldCurveObject;
    final double volatility = 0.3; //TODO
    final HazardRateCurve hazardRateCurve = (HazardRateCurve) hazardRateCurveObject;
    final NodalObjectsCurve<?, ?> spreadCurve = (NodalObjectsCurve<?, ?>) spreadCurveObject;
    final Tenor[] tenors = CreditFunctionUtils.getTenors(spreadCurve.getXData());
    final Double[] marketSpreadObjects = CreditFunctionUtils.getSpreads(spreadCurve.getYData());
    ParallelArrayBinarySort.parallelBinarySort(tenors, marketSpreadObjects);
    final int n = tenors.length;
View Full Code Here

    // Calibrate the hazard rate curve to the market observed par CDS spreads (returns calibrated hazard rates as a vector of doubles)
    final double[] calibratedHazardRates = hazardRateCurve.getCalibratedHazardRateTermStructure(valuationDate, cds, marketTenors, marketSpreads, yieldCurve, priceType);

    // Build a hazard rate curve object based on the input market data
    //final HazardRateCurve calibratedHazardRateCurve = new HazardRateCurve(times, calibratedHazardRates, 0.0);
    final HazardRateCurve calibratedHazardRateCurve = new HazardRateCurve(marketTenors, times, calibratedHazardRates, 0.0);

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

    // Create a new CDS identical to the input CDS except for the recovery rate
    final LegacyVanillaCreditDefaultSwapDefinition bumpedCDS = cds.withRecoveryRate(bumpedRecoveryRate);
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.