Package com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew

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


    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());
    final ValueProperties properties = desiredValues.iterator().next().getConstraints().copy()
        .with(ValuePropertyNames.FUNCTION, getUniqueId())
        .get();
    return getComputedValue(definition, yieldCurve, times, marketSpreads, valuationTime, target, properties, inputs, hazardCurve, pricingCDS);
  }
View Full Code Here


    final ExternalId regionId = security.getRegionId();
    final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, _regionSource.getHighestLevelRegion(regionId));
    final StubType stubType = security.getStubType().toAnalyticsType();
    final Period period = (IMMDateGenerator.isIMMDate(security.getMaturityDate())) ? getPeriodFrequency(security.getCouponFrequency()).getPeriod() :
        Period.ofMonths(6); // non IMM forced to semi annual
    final CDSAnalytic cdsAnalytic = new CDSAnalytic(_valuationDate,
                                                    security.getEffectiveDate().toLocalDate(),
                                                    // Hard code or get from somewhere?
                                                    BusinessDayDateUtils.addWorkDays(_valuationDate, 3, calendar),
                                                    _startDate == null ? security.getStartDate().toLocalDate() : _startDate,
                                                    _maturityDate == null ? security.getMaturityDate().toLocalDate() : _maturityDate,
View Full Code Here

    final ExternalId regionId = security.getRegionId();
    final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, _regionSource.getHighestLevelRegion(regionId));
    final StubType stubType = security.getStubType().toAnalyticsType();
    final Period period = (IMMDateGenerator.isIMMDate(security.getMaturityDate())) ? getPeriodFrequency(security.getCouponFrequency()).getPeriod() :
        Period.ofMonths(6); // non IMM forced to semi annual
    final CDSAnalytic cdsAnalytic = new CDSAnalytic(_valuationDate,
                                                    security.getEffectiveDate().toLocalDate(),
                                                    // Hard code or get from somewhere?
                                                    BusinessDayDateUtils.addWorkDays(_valuationDate, 3, calendar),
                                                    _startDate == null ? security.getStartDate().toLocalDate() : _startDate,
                                                    _maturityDate == null ? security.getMaturityDate().toLocalDate() : _maturityDate,
View Full Code Here

    final CDSAnalyticFactory analyticFactory = new CDSAnalyticFactory(cds.getRecoveryRate(), cds.getCouponFrequency().getPeriod())
        .with(cds.getBusinessDayAdjustmentConvention())
        .with(calendar).with(cds.getStubType())
        .withAccualDCC(cds.getDayCountFractionConvention());

    final CDSAnalytic pricingCDS = analyticFactory.makeCDS(valuationTime.toLocalDate(), cds.getEffectiveDate().toLocalDate(), cds.getMaturityDate().toLocalDate());
    double spread = 0;
    final ZonedDateTime[] times = new ZonedDateTime[n];
    final CDSAnalytic[] creditAnalytics = new CDSAnalytic[n];
    final double[] marketSpreads = new double[n];
    for (int i = 0; i < n; i++) {
View Full Code Here

    }
    final CDSAnalyticVisitor pricingVisitor = new CDSAnalyticVisitor(now.toLocalDate(),
                                                                     _holidaySource,
                                                                     _regionSource,
                                                                     recoveryRate);
    final CDSAnalytic pricingCDS = security.accept(pricingVisitor);
    final CDSQuoteConvention quote = SpreadCurveFunctions.getQuotes(security.getMaturityDate(),
                                                                    new double[]{cdsQuoteDouble},
                                                                    security.getParSpread(),
                                                                    quoteConvention,
                                                                    true)[0];
View Full Code Here

    final CDSAnalyticFactory analyticFactory = new CDSAnalyticFactory(cds.getRecoveryRate(), cds.getCouponFrequency().getPeriod())
        .with(cds.getBusinessDayAdjustmentConvention())
        .with(calendar).with(cds.getStubType())
        .withAccualDCC(cds.getDayCountFractionConvention());

    final CDSAnalytic pricingCDS = analyticFactory.makeCDS(valuationTime.toLocalDate(), cds.getEffectiveDate().toLocalDate(), cds.getMaturityDate().toLocalDate());
    double spread = 0;
    final ZonedDateTime[] times = new ZonedDateTime[n];
    final CDSAnalytic[] creditAnalytics = new CDSAnalytic[n];
    final double[] marketSpreads = new double[n];
    for (int i = 0; i < n; i++) {
View Full Code Here

      throw new OpenGammaRuntimeException("Couldnt get credit curve");
    }

    //final CDSAnalytic analytic = CDSAnalyticConverter.create(cds, now.toLocalDate());
    final CDSAnalyticVisitor visitor = new CDSAnalyticVisitor(now.toLocalDate(), _holidaySource, _regionSource, recoveryRate);
    final CDSAnalytic analytic = security.accept(visitor);
    final BuySellProtection buySellProtection = security.isBuy() ? BuySellProtection.BUY : BuySellProtection.SELL;
    final Double cdsQuoteDouble = (Double) inputs.getValue(MarketDataRequirementNames.MARKET_VALUE);
    if (cdsQuoteDouble == null) {
      throw new OpenGammaRuntimeException("Couldn't get spread for " + security);
    }
    final CDSQuoteConvention quote = SpreadCurveFunctions.getQuotes(security.getMaturityDate(), new double[] {cdsQuoteDouble}, security.getParSpread(), quoteConvention, true)[0];

    final double notional = security.getNotional().getAmount();
    final double coupon = security.getParSpread() * ONE_BPS;
    final PointsUpFront puf = getPointsUpfront(quote, buySellProtection, yieldCurve, analytic, creditCurve);
    final double accruedPremium = analytic.getAccruedPremium(coupon) * notional;
    final int accruedDays = analytic.getAccuredDays();
    final double quotedSpread = getQuotedSpread(quote, puf, buySellProtection, yieldCurve, analytic).getQuotedSpread();
    final double upfrontAmount = getUpfrontAmount(analytic, puf, notional, buySellProtection);
    final double cleanPV = puf.getPointsUpFront() * notional;
    final double cleanPrice = getCleanPrice(puf);
    final TenorLabelledMatrix1D bucketedCS01 = getBucketedCS01(analytic, bucketCDSs, spreadObject.getXData(), quote, notional, yieldCurve, creditCurve);
View Full Code Here

        .with(definition.getBusinessDayAdjustmentConvention())
        .with(definition.getCalendar()).with(definition.getStubType())
        .withAccualDCC(definition.getDayCountFractionConvention());

    double pv;
    final CDSAnalytic pricingCDS = analyticFactory.makeCDS(valuationDate.toLocalDate(), definition.getEffectiveDate().toLocalDate(), definition.getMaturityDate().toLocalDate());
    if (definition instanceof LegacyCreditDefaultSwapDefinition) {
      pv = PRICER.pv(pricingCDS, yieldCurve, hazardRateCurve, ((LegacyCreditDefaultSwapDefinition) definition).getParSpread()) * definition.getNotional();
    } else if (definition instanceof StandardCreditDefaultSwapDefinition) {
      pv = POINTS_UP_FRONT_CONVERTER.quotedSpreadToPUF(pricingCDS,
                                                        getCoupon(((StandardCreditDefaultSwapDefinition) definition).getPremiumLegCoupon()),
View Full Code Here

   * @param valuationDate the valuation date
   * @param maturityDate the maturity date - if null take from security
   * @return CDSAnalytic
   */
  public static CDSAnalytic create(final CreditDefaultSwapDefinition security, final LocalDate valuationDate, final LocalDate maturityDate) {
    final CDSAnalytic cdsAnalytic = new CDSAnalytic(valuationDate,
                                                    security.getEffectiveDate().toLocalDate(),
                                                    valuationDate.plusDays(3), //FIXME: Hard code or get from somewhere else?
                                                    security.getStartDate().toLocalDate(),
                                                    maturityDate != null ? maturityDate : security.getMaturityDate().toLocalDate(),
                                                    true, //FIXME: Do we have this info anywhere?
View Full Code Here

    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());
    final ValueProperties properties = desiredValues.iterator().next().getConstraints().copy()
        .with(ValuePropertyNames.FUNCTION, getUniqueId())
        .get();
    return getComputedValue(definition, yieldCurve, times, marketSpreads, valuationTime, target, properties, inputs, hazardCurve, pricingCDS);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.credit.creditdefaultswap.pricing.vanilla.isdanew.CDSAnalytic

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.