Package com.opengamma.financial.convention.calendar

Examples of com.opengamma.financial.convention.calendar.Calendar


    final ExternalId underlyingId = getUnderlyingId(spec, strip);
    Period fraPeriod;
    final Currency ccy = spec.getCurrency();
    BusinessDayConvention businessDayConvention;
    boolean eom;
    Calendar calendar;
    ExternalId underlyingIdentifier;
    int settlementDays;
    if (underlyingId == null) {
      s_logger.info("Could not get convention for underlying from {}; trying tenor-based convention", strip);
      final ConventionBundle fraConvention = _conventionBundleSource.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, spec.getCurrency().getCode() + "_" + months
View Full Code Here


    }
    final long months = resetTenor.getPeriod().toTotalMonths();
    final ConventionBundle fixedLegConvention = getFixedLegConvention(spec, strip, swapIdentifier);
    final ZonedDateTime curveDate = spec.getCurveDate().atStartOfDay(ZoneOffset.UTC);
    final String counterparty = "";
    Calendar calendar;
    ExternalId floatingRateId;
    FloatingInterestRateLeg iborLeg;
    final ExternalId underlyingId = getUnderlyingId(spec, strip);
    if (underlyingId == null) {
      s_logger.info("Could not get convention for underlying from {}; trying tenor-based convention", strip);
View Full Code Here

    if (rate == null) {
      throw new OpenGammaRuntimeException("No market data for " + swapIdentifier);
    }
    final ZonedDateTime curveDate = spec.getCurveDate().atStartOfDay(ZoneOffset.UTC);
    final ConventionBundle convention = _conventionBundleSource.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, "BRL_DI_SWAP"));
    final Calendar calendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, convention.getSwapFloatingLegRegion());
    final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(curveDate, convention.getSwapFixedLegSettlementDays(), calendar);
    final ZonedDateTime maturityDate = spotDate.plus(strip.getMaturity().getPeriod());
    final FixedInterestRateLeg fixedLeg = new FixedInterestRateLeg(convention.getSwapFixedLegDayCount(), convention.getSwapFixedLegFrequency(),
        convention.getSwapFixedLegRegion(), convention.getSwapFixedLegBusinessDayConvention(), new InterestRateNotional(spec.getCurrency(), 1), false, rate);
    final FloatingInterestRateLeg iborLeg = new FloatingInterestRateLeg(convention.getSwapFloatingLegDayCount(), convention.getSwapFloatingLegFrequency(),
View Full Code Here

    if (fixedLegConvention == null) {
      throw new OpenGammaRuntimeException("Could not get fixed leg convention for " + swapIdentifier);
    }
    final ZonedDateTime curveDate = spec.getCurveDate().atStartOfDay(ZoneOffset.UTC);
    final String counterparty = "";
    Calendar calendar;
    ExternalId floatingRateId;
    FloatingInterestRateLeg iborLeg;
    final ExternalId underlyingId = getUnderlyingId(spec, strip);
    if (underlyingId == null) {
      s_logger.info("Could not get convention for underlying from {}; trying tenor-based convention", strip);
View Full Code Here

    final String ccy = spec.getCurrency().getCode();
    final ExternalId payFloatingReferenceRateId = ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, payIndexType + "_" + ccy + "_" + payTenor.getPeriod().toString());
    final ExternalId receiveFloatingReferenceRateId = ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, receiveIndexType + "_" + ccy + "_" + receiveTenor.getPeriod().toString());
    final ConventionBundle payConvention = _conventionBundleSource.getConventionBundle(payFloatingReferenceRateId);
    final ConventionBundle receiveConvention = _conventionBundleSource.getConventionBundle(receiveFloatingReferenceRateId);
    final Calendar payCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, payConvention.getRegion());
    final ZonedDateTime paySpotDate = ScheduleCalculator.getAdjustedDate(curveDate, payConvention.getSettlementDays(), payCalendar);
    final ZonedDateTime payMaturityDate = paySpotDate.plus(strip.getMaturity().getPeriod());
    final String counterparty = "";
    final InterestRateNotional notional = new InterestRateNotional(spec.getCurrency(), 1);
    final ExternalId payRegionIdentifier = payConvention.getRegion();
View Full Code Here

      throw new OpenGammaRuntimeException("Could not get convention for id " + ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, spec.getCurrency().getCode() + "_OIS_SWAP"));
    }
    if (!swapConvention.getSwapFloatingLegFrequency().equals(swapConvention.getSwapFixedLegFrequency())) {
      throw new OpenGammaRuntimeException("Payment frequencies for the fixed and floating legs did not match");
    }
    final Calendar calendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, swapConvention.getSwapFloatingLegRegion());
    final ZonedDateTime curveDate = spec.getCurveDate().atStartOfDay(ZoneOffset.UTC);
    final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(curveDate, swapConvention.getSwapFixedLegSettlementDays(), calendar);
    final ZonedDateTime maturityDate = spotDate.plus(strip.getMaturity().getPeriod());
    final String counterparty = "";
    final Double rate = marketValues.getDataPoint(swapIdentifier);
View Full Code Here

  public LegacyVanillaCreditDefaultSwapDefinition visitStandardVanillaCDSSecurity(final StandardVanillaCDSSecurity security) {
    ArgumentChecker.notNull(security, "security");
    final BuySellProtection buySellProtection = security.isBuy() ? BuySellProtection.BUY : BuySellProtection.SELL;
    //final ExternalId regionId = security.getRegionId();
    //final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, _regionSource.getHighestLevelRegion(regionId));
    final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, security.getNotional().getCurrency());
    final ZonedDateTime startDate = security.getStartDate();
    final ZonedDateTime effectiveDate = security.getEffectiveDate(); //FOLLOWING.adjustDate(calendar, valuationDate.withHour(0).withMinute(0).withSecond(0).withNano(0).plusDays(1));
    final ZonedDateTime maturityDate = security.getMaturityDate();
    final PeriodFrequency couponFrequency = getPeriodFrequency(security.getCouponFrequency());
    final DayCount dayCount = security.getDayCount();
View Full Code Here

  public LegacyVanillaCreditDefaultSwapDefinition visitLegacyVanillaCDSSecurity(final LegacyVanillaCDSSecurity security) {
    ArgumentChecker.notNull(security, "security");
    final BuySellProtection buySellProtection = security.isBuy() ? BuySellProtection.BUY : BuySellProtection.SELL;
    //    final ExternalId regionId = security.getRegionId();
    //    final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, _regionSource.getHighestLevelRegion(regionId));
    final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, security.getNotional().getCurrency());
    final ZonedDateTime startDate = security.getStartDate();
    final ZonedDateTime effectiveDate = security.getEffectiveDate(); //FOLLOWING.adjustDate(calendar, valuationDate.withHour(0).withMinute(0).withSecond(0).withNano(0).plusDays(1));
    final ZonedDateTime maturityDate = security.getMaturityDate();
    final PeriodFrequency couponFrequency = getPeriodFrequency(security.getCouponFrequency());
    final DayCount dayCount = security.getDayCount();
View Full Code Here

    final ISDACDSDerivative cds = loadCDS_ISDAExampleUpfrontConverter().toDerivative(pricingDate, "IR_CURVE", "HAZARD_RATE_CURVE");
    final ISDACurve discountCurve = loadDiscountCurve_ISDAExampleExcel();

    final ISDAApproxCDSPricingMethod method = new ISDAApproxCDSPricingMethod();
    final Calendar calendar = new NoHolidayCalendar();
    final double cleanPrice = method.calculateUpfrontCharge(cds, discountCurve, 0.055, true, pricingDate, stepinDate, settlementDate, calendar);
    final double dirtyPrice = method.calculateUpfrontCharge(cds, discountCurve, 0.055, false, pricingDate, stepinDate, settlementDate, calendar);
    final double cleanPriceError = Math.abs( (cleanPrice - 185852.587288133) / cds.getNotional() );
    final double dirtyPriceError = Math.abs( (dirtyPrice - 59463.6983992436) / cds.getNotional() );
View Full Code Here

  @Override
  public LegacyVanillaCreditDefaultSwapDefinition visitStandardVanillaCDSSecurity(final StandardVanillaCDSSecurity security) {
    ArgumentChecker.notNull(security, "security");
    final BuySellProtection buySellProtection = security.isBuy() ? BuySellProtection.BUY : BuySellProtection.SELL;
    final ExternalId regionId = security.getRegionId();
    final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, _regionSource.getHighestLevelRegion(regionId));
    final ZonedDateTime startDate = security.getStartDate();
    final ZonedDateTime effectiveDate = security.getEffectiveDate();
    final ZonedDateTime maturityDate = security.getMaturityDate();
    final PeriodFrequency couponFrequency = getPeriodFrequency(security.getCouponFrequency());
    final DayCount dayCount = security.getDayCount();
View Full Code Here

TOP

Related Classes of com.opengamma.financial.convention.calendar.Calendar

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.