Package com.opengamma.analytics.financial.instrument.cds

Examples of com.opengamma.analytics.financial.instrument.cds.ISDACDSDefinition


    final double stepinDiscountFactor = offsetStepinTime > 0.0 ? discountCurve.getDiscountFactor(offsetStepinTime) : discountCurve.getDiscountFactor(0.0);

    final double[] timePoints = {cds.getMaturity()};
    final double[] dataPoints = {flatSpread};

    final ISDACDSDefinition bootstrapCDSDefinition = makeBootstrapCDSDefinition(cds, flatSpread, calendar);
    final ISDACDSDerivative bootstrapCDS = bootstrapCDSDefinition.toDerivative(pricingDate, stepinDate, settlementDate, cds.getDiscountCurveName(), cds.getSpreadCurveName());

    final double guess = dataPoints[0] / (1.0 - cds.getRecoveryRate());

    dataPoints[0] = HAZARD_SOLVER.findRoot(
      new Function1D<Double, Double>() {
View Full Code Here


    final ISDACDSPremiumDefinition premiumDefinition = ISDACDSPremiumDefinition.from(
      startDate, maturity, cds.getCouponFrequency(),
      cds.getConvention(), cds.getStubType(), cds.isProtectStart(),
      notional, parSpread, cds.getPremium().getCurrency(), calendar);

    return new ISDACDSDefinition(startDate, maturity, premiumDefinition, notional, parSpread, cds.getRecoveryRate(),
      cds.isAccrualOnDefault(), payOnDefault, protectStart,
      cds.getCouponFrequency(), cds.getConvention(), cds.getStubType());
  }
View Full Code Here

    final ISDACDSPremiumDefinition premiumPayments = ISDACDSPremiumDefinition.from(
      cds.getStartDate(), cds.getMaturity(), cds.getPremiumFrequency(),
      convention, cds.getStubType(), PROTECT_START,
      cds.getNotional(), cds.getSpread(), cds.getCurrency(), calendar);

    return new ISDACDSDefinition(cds.getStartDate(), cds.getMaturity(), premiumPayments,
      cds.getNotional(), cds.getSpread(), cds.getRecoveryRate(), ACCRUAL_ON_DEFAULT,
      PAY_ON_DEFAULT, PROTECT_START, cds.getPremiumFrequency(), convention, cds.getStubType());
  }
View Full Code Here

    final Frequency couponFrequency = SimpleFrequency.QUARTERLY;
    final StubType stubType = StubType.SHORT_START;

    // Now build the CDS object
    final ISDACDSPremiumDefinition premiumDefinition = ISDACDSPremiumDefinition.from(startDate, maturity, couponFrequency, convention, stubType, /* protect start */ true, /*notional*/ 1.0, spread, Currency.EUR, calendar);
    final ISDACDSDefinition cdsDefinition = new ISDACDSDefinition(startDate, maturity, premiumDefinition, /*notional*/1.0, spread, recoveryRate, /* accrualOnDefault */ true, /* payOnDefault */ true, /* protectStart */ true, couponFrequency, convention, stubType);
    final ISDACDSDerivative cds = cdsDefinition.toDerivative(pricingDate, stepinDate, settlementDate, "IR_CURVE");

    // Par spread is always supplied
    final double marketSpread = testCase.getQuotedSpread() / 10000.0;

    // Now go price
View Full Code Here

    final boolean protectStart = true;

    final ISDACDSPremiumDefinition premiumDefinition = ISDACDSPremiumDefinition.from(startDate, maturity, couponFrequency, convention, stubType, protectStart, notional, spread,
        Currency.EUR, calendar);

    return new ISDACDSDefinition(startDate, maturity, premiumDefinition, notional, spread, recoveryRate, accrualOnDefault, payOnDefault, protectStart, couponFrequency, convention, stubType);
  }
View Full Code Here

    final Convention convention = new Convention(settlementDays, dayCount, businessDays, calendar, "");
    final StubType stubType = StubType.SHORT_START;

    final ISDACDSPremiumDefinition premiumDefinition = ISDACDSPremiumDefinition.from(startDate, maturity, premiumFrequency, convention, stubType, /* protectStart */ true, notional, spread, Currency.EUR, calendar);

    return new ISDACDSDefinition(startDate, maturity, premiumDefinition, notional, spread, recoveryRate, /* accrualOnDefault */ true, /* payOnDefault */ true, /* protectStart */ true, premiumFrequency, convention, stubType);
  }
View Full Code Here

    final Convention convention = new Convention(settlementDays, dayCount, businessDays, calendar, "");
    final StubType stubType = StubType.SHORT_START;

    final ISDACDSPremiumDefinition premiumDefinition = ISDACDSPremiumDefinition.from(startDate, maturity, couponFrequency, convention, stubType, /* protectStart */ true, notional, spread, Currency.EUR, calendar);

    return new ISDACDSDefinition(startDate, maturity, premiumDefinition, notional, spread, recoveryRate, /* accrualOnDefault */ true, /* payOnDefault */ true, /* protectStart */ true, couponFrequency, convention, stubType);
  }
View Full Code Here

    final Convention convention = new Convention(settlementDays, dayCount, businessDays, calendar, "");
    final StubType stubType = StubType.SHORT_START;

    final ISDACDSPremiumDefinition premiumDefinition = ISDACDSPremiumDefinition.from(startDate, maturity, couponFrequency, convention, stubType, /* protectStart */ true, notional, spread, Currency.EUR, calendar);

    return new ISDACDSDefinition(startDate, maturity, premiumDefinition, notional, spread, recoveryRate, /* accrualOnDefault */ true, /* payOnDefault */ true, /* protectStart */ true, couponFrequency, convention, stubType);
  }
View Full Code Here

    final HolidaySource holidaySource = OpenGammaExecutionContext.getHolidaySource(executionContext);
    final ISDACDSSecurityConverter converter = new ISDACDSSecurityConverter(holidaySource);

    // Security being priced
    final CDSSecurity cds = (CDSSecurity) target.getSecurity();
    final ISDACDSDefinition cdsDefinition = (ISDACDSDefinition) cds.accept(converter);

    // Time point to price for
    // TODO: Supply an option for the user to specify non-standard step-in and settlement dates
    final ZonedDateTime pricingDate = ZonedDateTime.now(executionContext.getValuationClock());
    final ZonedDateTime stepinDate = pricingDate.plusDays(1);
    final ZonedDateTime settlementDate = findSettlementDate(pricingDate, cdsDefinition.getConvention());

    // Discount curve
    final ISDACurve discountCurve = (ISDACurve) inputs.getValue(ValueRequirementNames.YIELD_CURVE);
    final double flatSpread = (Double) inputs.getValue(ValueRequirementNames.SPOT_RATE);

    // Convert security in to format suitable for pricing
    final ISDACDSDerivative cdsDerivative = cdsDefinition.toDerivative(pricingDate, stepinDate, settlementDate, discountCurve.getName());

    // Go price!
    final double dirtyPrice = ISDA_APPROX_METHOD.calculateUpfrontCharge(cdsDerivative, discountCurve, flatSpread, false, pricingDate, stepinDate, settlementDate, CALENDAR);
    final double cleanPrice = dirtyPrice - cdsDerivative.getAccruedInterest();
View Full Code Here

    final HolidaySource holidaySource = OpenGammaExecutionContext.getHolidaySource(executionContext);
    final ISDACDSSecurityConverter converter = new ISDACDSSecurityConverter(holidaySource);

    // Security being priced
    final CDSSecurity cds = (CDSSecurity) target.getSecurity();
    final ISDACDSDefinition cdsDefinition = (ISDACDSDefinition) cds.accept(converter);

    // Time point to price for
    // TODO: Supply an option for the user to specify non-standard step-in and settlement dates
    final ZonedDateTime pricingDate = ZonedDateTime.now(executionContext.getValuationClock());
    final ZonedDateTime stepinDate = pricingDate.plusDays(1);
    final ZonedDateTime settlementDate = findSettlementDate(pricingDate, cdsDefinition.getConvention());

    // Discount curve
    final ISDACurve discountCurve = (ISDACurve) inputs.getValue(new ValueRequirement(
        ValueRequirementNames.YIELD_CURVE, ComputationTargetSpecification.of(cds.getCurrency()),
      ValueProperties.with(ValuePropertyNames.CALCULATION_METHOD, ISDAFunctionConstants.ISDA_METHOD_NAME).get()));

    // Hazard rate curve
    final ISDACurve hazardRateCurve = (ISDACurve) inputs.getValue(new ValueRequirement(
        ValueRequirementNames.YIELD_CURVE, ComputationTargetSpecification.of(cds.getCurrency()),
      ValueProperties
        .with(ValuePropertyNames.CURVE, "HAZARD_" + cds.getUnderlyingIssuer() + "_" + cds.getUnderlyingSeniority() + "_" + cds.getRestructuringClause())
        .with(ValuePropertyNames.CALCULATION_METHOD, ISDAFunctionConstants.ISDA_METHOD_NAME)
        .get()));

    // Convert security in to format suitable for pricing
    final ISDACDSDerivative cdsDerivative = cdsDefinition.toDerivative(pricingDate, stepinDate, settlementDate, discountCurve.getName(), hazardRateCurve.getName());

    // Go price!
    final double dirtyPrice = ISDA_APPROX_METHOD.calculateUpfrontCharge(cdsDerivative, discountCurve, hazardRateCurve, false);
    final double cleanPrice = dirtyPrice - cdsDerivative.getAccruedInterest();
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.instrument.cds.ISDACDSDefinition

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.