Package com.opengamma.financial.security.swap

Examples of com.opengamma.financial.security.swap.FixedInflationSwapLeg


    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "311"));
    return security;
  }

  public static YearOnYearInflationSwapSecurity getPayYoYInflationSwapSecurity() {
    final FixedInflationSwapLeg fixedLeg = new FixedInflationSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), false, 0.02);
    final InflationIndexSwapLeg indexLeg = new InflationIndexSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), true, ExternalSchemes.syntheticSecurityId("CPI"), 2, 3, InterpolationMethod.MONTH_START_LINEAR);
    final YearOnYearInflationSwapSecurity security = new YearOnYearInflationSwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        fixedLeg, indexLeg, true, true, Tenor.TEN_YEARS);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "36"));
    return security;
View Full Code Here


    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "36"));
    return security;
  }

  public static YearOnYearInflationSwapSecurity getReceiveYoYInflationSwapSecurity() {
    final FixedInflationSwapLeg fixedLeg = new FixedInflationSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), false, 0.02);
    final InflationIndexSwapLeg indexLeg = new InflationIndexSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), false, ExternalSchemes.syntheticSecurityId("CPI"), 2, 3, InterpolationMethod.MONTH_START_LINEAR);
    final YearOnYearInflationSwapSecurity security = new YearOnYearInflationSwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        indexLeg, fixedLeg, true, true, Tenor.TEN_YEARS);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "4562"));
    return security;
View Full Code Here

    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "4562"));
    return security;
  }

  public static ZeroCouponInflationSwapSecurity getPayZeroCouponInflationSwapSecurity() {
    final FixedInflationSwapLeg fixedLeg = new FixedInflationSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), false, 0.02);
    final InflationIndexSwapLeg indexLeg = new InflationIndexSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), true, ExternalSchemes.syntheticSecurityId("CPI"), 2, 3, InterpolationMethod.MONTH_START_LINEAR);
    final ZeroCouponInflationSwapSecurity security = new ZeroCouponInflationSwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        fixedLeg, indexLeg);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "684"));
    return security;
View Full Code Here

    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "684"));
    return security;
  }

  public static ZeroCouponInflationSwapSecurity getReceiveZeroCouponInflationSwapSecurity() {
    final FixedInflationSwapLeg fixedLeg = new FixedInflationSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), false, 0.02);
    final InflationIndexSwapLeg indexLeg = new InflationIndexSwapLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), false, ExternalSchemes.syntheticSecurityId("CPI"), 2, 3, InterpolationMethod.MONTH_START_LINEAR);
    final ZeroCouponInflationSwapSecurity security = new ZeroCouponInflationSwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        fixedLeg, indexLeg);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "3216"));
    return security;
View Full Code Here

      throw new OpenGammaRuntimeException("Inflation leg convention with id " + getIds(currency, INFLATION_LEG) + " was null");
    }
    final IndexPrice priceIndex = new IndexPrice(indexConvention.getName(), currency);
    final SwapLeg payLeg = security.getPayLeg();
    final SwapLeg receiveLeg = security.getReceiveLeg();
    final FixedInflationSwapLeg fixedLeg;
    final InflationIndexSwapLeg indexLeg;
    final boolean isPayer;
    if (payLeg instanceof FixedInflationSwapLeg && receiveLeg instanceof InflationIndexSwapLeg) {
      fixedLeg = (FixedInflationSwapLeg) payLeg;
      indexLeg = (InflationIndexSwapLeg) receiveLeg;
      isPayer = true;
    } else if (payLeg instanceof InflationIndexSwapLeg && receiveLeg instanceof FixedInflationSwapLeg) {
      fixedLeg = (FixedInflationSwapLeg) receiveLeg;
      indexLeg = (InflationIndexSwapLeg) payLeg;
      isPayer = false;
    } else {
      throw new OpenGammaRuntimeException("Can only convert fixed / float inflation swaps");
    }
    final int settlementDays = fixedLegConvention.getSettlementDays();
    final boolean isEOM = fixedLegConvention.isIsEOM();
    final DayCount fixedLegDayCount = fixedLeg.getDayCount();
    final BusinessDayConvention businessDayConvention = fixedLeg.getBusinessDayConvention();
    final Calendar calendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getRegion());
    final ZoneOffset zone = ZoneOffset.UTC; //TODO
    final Period paymentPeriod = getTenor(indexLeg.getFrequency());
    final Period maturityTenor = security.getMaturityTenor().getPeriod();
    boolean isMonthly;
    switch (indexLeg.getInterpolationMethod()) {
      case MONTH_START_LINEAR:
        isMonthly = true;
        break;
      case NONE:
        isMonthly = false;
        break;
      default:
        throw new OpenGammaRuntimeException("Cannot handle interpolation method of type " + indexLeg.getInterpolationMethod());
    }
    final ZonedDateTime settlementDate = ScheduleCalculator.getAdjustedDate(security.getEffectiveDate(), settlementDays, calendar).toLocalDate().atStartOfDay(zone);
    final double fixedRate = fixedLeg.getRate();
    final int conventionalMonthLag = indexLeg.getConventionalIndexationLag();
    final int quotationMonthLag = indexLeg.getQuotationIndexationLag();
    final boolean exchangeNotional = security.isExchangeInitialNotional() && security.isExchangeFinalNotional();
    final double notional = ((InterestRateNotional) fixedLeg.getNotional()).getAmount();
    if (isMonthly) {
      return SwapFixedInflationYearOnYearDefinition.fromMonthly(priceIndex, settlementDate, paymentPeriod, (int) (maturityTenor.toTotalMonths() / 12), fixedRate,
          notional, isPayer, businessDayConvention, calendar, isEOM, fixedLegDayCount, conventionalMonthLag, quotationMonthLag, exchangeNotional);
    }
    return SwapFixedInflationYearOnYearDefinition.fromInterpolation(priceIndex, settlementDate, paymentPeriod, maturityTenor, fixedRate,
View Full Code Here

      throw new OpenGammaRuntimeException("Inflation leg convention with id " + getIds(currency, INFLATION_LEG) + " was null");
    }
    final IndexPrice priceIndex = new IndexPrice(indexConvention.getName(), currency);
    final SwapLeg payLeg = security.getPayLeg();
    final SwapLeg receiveLeg = security.getReceiveLeg();
    final FixedInflationSwapLeg fixedLeg;
    final InflationIndexSwapLeg indexLeg;
    final boolean isPayer;
    if (payLeg instanceof FixedInflationSwapLeg && receiveLeg instanceof InflationIndexSwapLeg) {
      fixedLeg = (FixedInflationSwapLeg) payLeg;
      indexLeg = (InflationIndexSwapLeg) receiveLeg;
      isPayer = true;
    } else if (payLeg instanceof InflationIndexSwapLeg && receiveLeg instanceof FixedInflationSwapLeg) {
      fixedLeg = (FixedInflationSwapLeg) receiveLeg;
      indexLeg = (InflationIndexSwapLeg) payLeg;
      isPayer = false;
    } else {
      throw new OpenGammaRuntimeException("Can only convert fixed / float inflation swaps");
    }
    final int settlementDays = fixedLegConvention.getSettlementDays();
    final boolean isEOM = fixedLegConvention.isIsEOM();
    final BusinessDayConvention businessDayConvention = fixedLeg.getBusinessDayConvention();
    final Calendar calendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getRegion());
    final ZoneOffset zone = ZoneOffset.UTC; //TODO
   
    final int swapMaturityTenor = (int) Math.round(indexLeg.getDayCount().getDayCountFraction(security.getEffectiveDate(), security.getMaturityDate()));
    boolean isMonthly;
    switch (indexLeg.getInterpolationMethod()) {
      case MONTH_START_LINEAR:
        isMonthly = true;
        break;
      case NONE:
        isMonthly = false;
        break;
      default:
        throw new OpenGammaRuntimeException("Cannot handle interpolation method of type " + indexLeg.getInterpolationMethod());
    }
    final ZonedDateTime settlementDate = ScheduleCalculator.getAdjustedDate(security.getEffectiveDate(), settlementDays, calendar).toLocalDate().atStartOfDay(zone);
    final double fixedRate = fixedLeg.getRate();
    final int conventionalMonthLag = indexLeg.getConventionalIndexationLag();
    final int quotationMonthLag = indexLeg.getQuotationIndexationLag();
    final double notional = ((InterestRateNotional) fixedLeg.getNotional()).getAmount();
    if (isMonthly) {
      return SwapFixedInflationZeroCouponDefinition.fromMonthly(priceIndex, settlementDate, swapMaturityTenor, fixedRate,
          notional, isPayer, businessDayConvention, calendar, isEOM, conventionalMonthLag, quotationMonthLag);
    }
    return SwapFixedInflationZeroCouponDefinition.fromInterpolation(priceIndex, settlementDate, swapMaturityTenor, fixedRate,
View Full Code Here

            bean.getAnnualizationFactor());
      }

      @Override
      public SwapLeg visitFixedInflationSwapLeg(FixedInflationSwapLeg swapLeg) {
        return new FixedInflationSwapLeg(
            dayCountBeanToDayCount(bean.getDayCount()),
            frequencyBeanToFrequency(bean.getFrequency()),
            externalIdBeanToExternalId(bean.getRegion()),
            businessDayConventionBeanToBusinessDayConvention(bean.getBusinessDayConvention()),
            NotionalBeanOperation.createNotional(bean.getNotional()),
View Full Code Here

        ExternalId.of("Rate", "ABC"),
        FloatingRateType.IBOR);
  }

  private static SwapLeg fixedInflationLeg(final Frequency frequency) {
    return new FixedInflationSwapLeg(DayCountFactory.INSTANCE.getDayCount("Actual/360"),
        frequency,
        ExternalId.of("Reg", "123"),
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"),
        new InterestRateNotional(Currency.USD, 1234),
        true,
View Full Code Here

TOP

Related Classes of com.opengamma.financial.security.swap.FixedInflationSwapLeg

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.