Examples of ISDACompliantCreditCurve


Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

      final double[] r = deserializer.fieldValueToObject(double[].class, message.getByName(R_FIELD_NAME));
      final double[] rt = deserializer.fieldValueToObject(double[].class, message.getByName(RT_FIELD_NAME));
      final double[] df = deserializer.fieldValueToObject(double[].class, message.getByName(DF_FIELD_NAME));
      final double offsetR  =  message.getDouble(OFFSET_R_FIELD_NAME);
      final double offsetRt =  message.getDouble(OFFSET_RT_FIELD_NAME);
      return new ISDACompliantCreditCurve(t, r, rt, df, offsetR, offsetRt);
    }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

    CDSAnalytic[] buckets = analyticFactory.makeIMMCDS(definition.getStartDate().toLocalDate(), tenors);

    for (int i = 0; i < times.length; i++) {
      final double[] bumpedUpRates = SPREAD_BUMPER.getBumpedCreditSpreads(marketSpreads, i, spreadCurveBump * 1e-4, spreadBumpType);
      final double[] bumpedDownRates = SPREAD_BUMPER.getBumpedCreditSpreads(marketSpreads, i, -spreadCurveBump * 1e-4, spreadBumpType);
      final ISDACompliantCreditCurve bumpedUpCreditCurve = CURVE_BUILDER.calibrateCreditCurve(buckets, bumpedUpRates, yieldCurve);
      final ISDACompliantCreditCurve bumpedDownCreditCurve = CURVE_BUILDER.calibrateCreditCurve(buckets, bumpedDownRates, yieldCurve);
      final double pv = StandardVanillaPresentValueCDSFunction.presentValue(definition, yieldCurve, hazardCurve, analytic);
      final double bumpedUpPresentValue = StandardVanillaPresentValueCDSFunction.presentValue(definition, yieldCurve, bumpedUpCreditCurve, analytic);
      final double bumpedDownPresentValue = StandardVanillaPresentValueCDSFunction.presentValue(definition, yieldCurve, bumpedDownCreditCurve, analytic);
      gammaCS01[i] = (bumpedUpPresentValue - 2 * pv + bumpedDownPresentValue) / (2 * spreadCurveBump);
      dates[i] = times[i].toLocalDate();
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

  public static double parallelGammaCS01(CreditDefaultSwapDefinition definition, ISDACompliantYieldCurve yieldCurve, ISDACompliantCreditCurve hazardCurve,
                                   CDSAnalytic analytic, double spreadCurveBump, SpreadBumpType spreadBumpType) {
    final double[] rates = hazardCurve.getR();
    final double[] bumpedUpRates = SPREAD_BUMPER.getBumpedCreditSpreads(rates, spreadCurveBump * 1e-4, spreadBumpType);
    final double[] bumpedDownRates = SPREAD_BUMPER.getBumpedCreditSpreads(rates, -spreadCurveBump * 1e-4, spreadBumpType);
    final ISDACompliantCreditCurve bumpedUpCreditCurve = hazardCurve.withRates(bumpedUpRates);
    final ISDACompliantCreditCurve bumpedDownCreditCurve = hazardCurve.withRates(bumpedDownRates);
    final double pv = StandardVanillaPresentValueCDSFunction.presentValue(definition, yieldCurve, hazardCurve, analytic);
    final double bumpedUpPresentValue = StandardVanillaPresentValueCDSFunction.presentValue(definition, yieldCurve, bumpedUpCreditCurve, analytic);
    final double bumpedDownPresentValue = StandardVanillaPresentValueCDSFunction.presentValue(definition, yieldCurve, bumpedDownCreditCurve, analytic);
    return (bumpedUpPresentValue - 2 * pv + bumpedDownPresentValue) / (spreadCurveBump * spreadCurveBump);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

  @Test
  public void testISDACompliantCreditCurve() {
    final double[] times = new double[] {0, .25, .5, .75, 1};
    final double[] rates = new double[] {0.01, 0.02, 0.03, 0.04, 0.05};
    final ISDACompliantCreditCurve curve = new ISDACompliantCreditCurve(times, rates);
    assertEquals(curve, cycleObject(ISDACompliantCreditCurve.class, curve));
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

    final double[] marketSpreads = new double[n];
    for (int i = 0; i < n; i++) {
      times[i] = IMMDateGenerator.getNextIMMDate(valuationTime, tenors[i]).withHour(0).withMinute(0).withSecond(0).withNano(0);
      marketSpreads[i] = marketSpreadObjects[i] * 1e-4;
    }
    ISDACompliantCreditCurve hazardCurve = (ISDACompliantCreditCurve) inputs.getValue(ValueRequirementNames.HAZARD_RATE_CURVE);
    final CDSAnalyticFactory analyticFactory = new CDSAnalyticFactory(0, definition.getCouponFrequency().getPeriod())
        .with(definition.getBusinessDayAdjustmentConvention())
        .with(definition.getCalendar()).with(definition.getStubType())
        .withAccualDCC(definition.getDayCountFractionConvention());
    final CDSAnalytic pricingCDS = analyticFactory.makeCDS(definition.getStartDate().toLocalDate(), definition.getEffectiveDate().toLocalDate(), definition.getMaturityDate().toLocalDate());
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

      }
    }
    final ValueProperties properties = Iterables.getOnlyElement(desiredValues).getConstraints().copy()
        .with(ValuePropertyNames.FUNCTION, getUniqueId())
        .get();
    final ISDACompliantCreditCurve curve;

    if (IMMDateGenerator.isIMMDate(cds.getMaturityDate())) {
      curve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(pricingCDS, spread, yieldCurve);
    } else {
      curve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(creditAnalytics, marketSpreads, yieldCurve);
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

                                                      security.isBuy() ? BuySellProtection.BUY : BuySellProtection.SELL,
                                                      yieldCurve,
                                                      pricingCDS,
                                                      security.getParSpread());

    ISDACompliantCreditCurve creditCurve;
    NodalTenorDoubleCurve modifiedSpreadCurve;
    NodalTenorDoubleCurve modifiedPillarCurve;

    if (IMMDateGenerator.isIMMDate(security.getMaturityDate())) {
      final String pillarString = requirement.getConstraint(ISDAFunctionConstants.ISDA_BUCKET_TENORS);
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

    final ValueProperties properties = Iterables.getOnlyElement(desiredValues).getConstraints().copy()
        .with(ValuePropertyNames.FUNCTION, getUniqueId())
        .get();
    //final ISDAYieldCurveAndSpreadsProvider data = new ISDAYieldCurveAndSpreadsProvider(times, marketSpreads, yieldCurve);
    //final HazardRateCurve curve = CALCULATOR.calibrateHazardRateCurve(cds, data, valuationTime);
    final ISDACompliantCreditCurve curve;

    if (IMMDateGenerator.isIMMDate(cds.getMaturityDate())) {
      curve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(pricingCDS, spread, yieldCurve);
    } else {
      curve = CREDIT_CURVE_BUILDER.calibrateCreditCurve(creditAnalytics, marketSpreads, yieldCurve);
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

      //security.setMaturityDate(bucketDates[i]);
      final CDSAnalyticVisitor visitor = new CDSAnalyticVisitor(now.toLocalDate(), _holidaySource, _regionSource, security.getStartDate().toLocalDate(), pillarDates[i].toLocalDate(), recoveryRate);
      pillarCDSs[i] = security.accept(visitor);
    }

    final ISDACompliantCreditCurve creditCurve = (ISDACompliantCreditCurve) inputs.getValue(ValueRequirementNames.HAZARD_RATE_CURVE);
    if (creditCurve == null) {
      throw new OpenGammaRuntimeException("Couldnt get credit curve");
    }

    //final CDSAnalytic analytic = CDSAnalyticConverter.create(cds, now.toLocalDate());
View Full Code Here

Examples of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.ISDACompliantCreditCurve

                                                CDSAnalytic analytic) {
    final Object hazardRateCurveObject = inputs.getValue(ValueRequirementNames.HAZARD_RATE_CURVE);
    if (hazardRateCurveObject == null) {
      throw new OpenGammaRuntimeException("Could not get hazard rate curve");
    }
    final ISDACompliantCreditCurve hazardRateCurve = (ISDACompliantCreditCurve) hazardRateCurveObject;

    final CDSAnalyticFactory analyticFactory = new CDSAnalyticFactory(definition.getRecoveryRate(), definition.getCouponFrequency().getPeriod())
        .with(definition.getBusinessDayAdjustmentConvention())
        .with(definition.getCalendar()).with(definition.getStubType())
        .withAccualDCC(definition.getDayCountFractionConvention());
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.