Package com.opengamma.financial.convention

Examples of com.opengamma.financial.convention.InflationLegConvention$Meta


      final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount(message.getString(DAYCOUNT_FIELD));
      final boolean isEOM = message.getBoolean(IS_EOM_FIELD);
      final int monthLag = message.getInt(MONTH_LAG_FIELD);
      final int spotLag = message.getInt(SPOT_LAG_FIELD);
      final ExternalId priceIndexConvention = deserializer.fieldValueToObject(ExternalId.class, message.getByName(PRICE_INDEX_FIELD));
      final InflationLegConvention convention = new InflationLegConvention(name, externalIdBundle, businessDayConvention, dayCount,
          isEOM, monthLag, spotLag, priceIndexConvention);
      final FudgeField uniqueIdMsg = message.getByName(UNIQUE_ID_FIELD);
      if (uniqueIdMsg != null) {
        convention.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdMsg));
      }
      return convention;
    }
View Full Code Here


    }
    final SwapFixedLegConvention fixedLegConvention = _conventionSource.getConvention(SwapFixedLegConvention.class, inflationNode.getFixedLegConvention());
    if (fixedLegConvention == null) {
      throw new OpenGammaRuntimeException("Convention with id " + inflationNode.getFixedLegConvention() + " was null");
    }
    final InflationLegConvention inflationLegConvention = _conventionSource.getConvention(InflationLegConvention.class, inflationNode.getInflationLegConvention());
    if (inflationLegConvention == null) {
      throw new OpenGammaRuntimeException("Convention with id " + inflationNode.getInflationLegConvention() + " was null");
    }
    final PriceIndexConvention priceIndexConvention = _conventionSource.getConvention(PriceIndexConvention.class, inflationLegConvention.getPriceIndexConvention());
    if (priceIndexConvention == null) {
      throw new OpenGammaRuntimeException("Convention with id " + inflationLegConvention.getPriceIndexConvention() + " was null");
    }
    final int settlementDays = fixedLegConvention.getSettlementDays();
    final Period tenor = inflationNode.getTenor().getPeriod();
    final double notional = 1;
    //TODO business day convention and currency are in both conventions - should we enforce that they're the same or use
    // different ones for each leg?
    final BusinessDayConvention businessDayConvention = fixedLegConvention.getBusinessDayConvention();
    final boolean endOfMonth = fixedLegConvention.isIsEOM();
    final Currency currency = priceIndexConvention.getCurrency();
    final Calendar calendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, priceIndexConvention.getRegion());
    final ZoneId zone = _valuationTime.getZone(); //TODO time zone set to midnight UTC
    final ZonedDateTime settlementDate = ScheduleCalculator.getAdjustedDate(_valuationTime, settlementDays, calendar).toLocalDate().atStartOfDay(zone);
    final ZonedDateTime paymentDate = ScheduleCalculator.getAdjustedDate(settlementDate, tenor, businessDayConvention, calendar, endOfMonth).toLocalDate().atStartOfDay(zone);
    final CouponFixedCompoundingDefinition fixedCoupon = CouponFixedCompoundingDefinition.from(currency, settlementDate, paymentDate, notional, tenor.getYears(),
        rate);
    final HistoricalTimeSeries ts = _timeSeries.get(MarketDataRequirementNames.MARKET_VALUE, priceIndexConvention.getPriceIndexId());
    if (ts == null) {
      throw new OpenGammaRuntimeException("Could not get price index time series with id " + priceIndexConvention.getPriceIndexId());
    }
    final LocalDateDoubleTimeSeries localDateTS = ts.getTimeSeries();
    final DoubleTimeSeries<ZonedDateTime> priceIndexTimeSeries = convertTimeSeries(zone, localDateTS);
    final int conventionalMonthLag = inflationLegConvention.getMonthLag();
    final int monthLag = inflationLegConvention.getMonthLag();
    final IndexPrice index = new IndexPrice(priceIndexConvention.getName(), currency);
    switch (inflationNode.getInflationNodeType()) {
      case INTERPOLATED:
      {
        final CouponInflationZeroCouponInterpolationDefinition inflationCoupon = CouponInflationZeroCouponInterpolationDefinition.from(settlementDate, paymentDate,
View Full Code Here

    }
    final SwapFixedLegConvention fixedLegConvention = _conventionSource.getConvention(SwapFixedLegConvention.class, getIds(currency, IRS_FIXED_LEG));
    if (fixedLegConvention == null) {
      throw new OpenGammaRuntimeException("Swap fixed leg convention with id " + getIds(currency, IRS_FIXED_LEG) + " was null");
    }
    final InflationLegConvention inflationLegConvention = _conventionSource.getConvention(InflationLegConvention.class, getIds(currency, INFLATION_LEG));
    if (inflationLegConvention == null) {
      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();
View Full Code Here

    }
    final SwapFixedLegConvention fixedLegConvention = _conventionSource.getConvention(SwapFixedLegConvention.class, getIds(currency, IRS_FIXED_LEG));
    if (fixedLegConvention == null) {
      throw new OpenGammaRuntimeException("Swap fixed leg convention with id " + getIds(currency, IRS_FIXED_LEG) + " was null");
    }
    final InflationLegConvention inflationLegConvention = _conventionSource.getConvention(InflationLegConvention.class, getIds(currency, INFLATION_LEG));
    if (inflationLegConvention == null) {
      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();
View Full Code Here

          throw new OpenGammaRuntimeException("Convention with id " + inflationNode.getInflationLegConvention() + " was null");
        }
        if (!(convention instanceof InflationLegConvention)) {
          throw new OpenGammaRuntimeException("Cannot handle convention type " + convention.getClass());
        }
        final InflationLegConvention inflationLegConvention = (InflationLegConvention) convention;
        convention = conventionSource.getConvention(inflationLegConvention.getPriceIndexConvention());
        if (convention == null) {
          throw new OpenGammaRuntimeException("Convention with id " + inflationLegConvention.getPriceIndexConvention() + " was null");
        }
        if (!(convention instanceof PriceIndexConvention)) {
          throw new OpenGammaRuntimeException("Cannot handle convention type " + convention.getClass());
        }
        final String priceIndexField = MarketDataRequirementNames.MARKET_VALUE; //TODO
View Full Code Here

              throw new OpenGammaRuntimeException("Convention with id " + inflationNode.getInflationLegConvention() + " was null");
            }
            if (!(convention instanceof InflationLegConvention)) {
              throw new OpenGammaRuntimeException("Cannot handle convention type " + convention.getClass());
            }
            final InflationLegConvention inflationLegConvention = (InflationLegConvention) convention;
            convention = conventionSource.getConvention(inflationLegConvention.getPriceIndexConvention());
            if (convention == null) {
              throw new OpenGammaRuntimeException("Convention with id " + inflationLegConvention.getPriceIndexConvention() + " was null");
            }
            if (!(convention instanceof PriceIndexConvention)) {
              throw new OpenGammaRuntimeException("Cannot handle convention type " + convention.getClass());
            }
            ids = ExternalIdBundle.of(((PriceIndexConvention) convention).getPriceIndexId());
View Full Code Here

        ExternalIdBundle.of(SCHEME_NAME, CME_DELIVERABLE_SWAP_FUTURE), ExternalId.of(ExchangeTradedInstrumentExpiryCalculator.SCHEME,
            IMMFutureAndFutureOptionQuarterlyExpiryCalculator.NAME), US, liborConventionId, 100000);
    // Inflation
    final PriceIndexConvention priceIndexConvention = new PriceIndexConvention(priceIndexName, getIds(Currency.USD, PRICE_INDEX), Currency.USD, US,
        ExternalSchemes.bloombergTickerSecurityId("CPURNSA Index"));
    final Convention inflationConvention = new InflationLegConvention(inflationConventionName, getIds(Currency.USD, INFLATION_LEG), MODIFIED_FOLLOWING, ACT_360, false, 3, 2,
        priceIndexId);
    // US Treasury: Synthetic swaps to represent bonds, using yield
    final String fixedLegGovtConventionName = getConventionName(Currency.USD, TENOR_STR_6M, GOVT + FIXED_LEG);
    final Convention fixedLegGovtConvention = new SwapFixedLegConvention(fixedLegGovtConventionName, getIds(Currency.USD, TENOR_STR_6M, GOVT + FIXED_LEG),
        Tenor.SIX_MONTHS, ACT_ACT, FOLLOWING, Currency.USD, US, 2, false, StubType.SHORT_START, false, 0);
View Full Code Here

    assertEquals(convention, cycleObject(VanillaIborLegConvention.class, convention));
  }

  @Test
  public void testInflationLegConvention() {
    final InflationLegConvention convention = new InflationLegConvention("CPI", ExternalIdBundle.of(InMemoryConventionBundleMaster.simpleNameSecurityId("CPI")),
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), DayCountFactory.INSTANCE.getDayCount("Act/360"), true, 3, 1, ExternalId.of("Test", "Price"));
    convention.setUniqueId(UniqueId.of("Test", "98657"));
    assertEquals(convention, cycleObject(InflationLegConvention.class, convention));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.convention.InflationLegConvention$Meta

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.