Examples of toTotalMonths()


Examples of org.threeten.bp.Period.toTotalMonths()

  public FRASecurity visitFRANode(final FRANode fraNode) {
    final Convention convention = _conventionSource.getConvention(fraNode.getConvention());
    final Period startPeriod = fraNode.getFixingStart().getPeriod();
    final Period endPeriod = fraNode.getFixingEnd().getPeriod();
    //TODO probably need a specific FRA convention to hold the reset tenor
    final long months = endPeriod.toTotalMonths() - startPeriod.toTotalMonths();
    final Period indexTenor = Period.ofMonths((int) months);
    final IborIndexConvention indexConvention;
    if (convention instanceof IborIndexConvention) {
      indexConvention = (IborIndexConvention) convention;
    } else {
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

                                                                       calendar,
                                                                       isEOM);
      final double accrualFactor = dayCount.getDayCountFraction(startDate, endDate);
      final int spotLag = iborConvention.getSettlementDays();
      final boolean eom = iborConvention.isIsEOM();
      final long months = maturityPeriod.toTotalMonths() - startPeriod.toTotalMonths();
      final Period indexTenor = Period.ofMonths((int) months);
      final IborIndex iborIndex = new IborIndex(currency,
                                                indexTenor,
                                                spotLag,
                                                dayCount,
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

    final IborIndexConvention indexConvention = _conventionSource.getConvention(IborIndexConvention.class, rateFuture.getUnderlyingConvention());
    if (indexConvention == null) {
      throw new OpenGammaRuntimeException("Underlying convention was null");
    }
    final Period indexTenor = rateFuture.getUnderlyingTenor().getPeriod();
    final double paymentAccrualFactor = indexTenor.toTotalMonths() / 12.; //TODO don't use this method
    final Currency currency = indexConvention.getCurrency();
    final Calendar fixingCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getFixingCalendar());
    final Calendar regionCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getRegionCalendar());
    final BusinessDayConvention businessDayConvention = indexConvention.getBusinessDayConvention();
    final DayCount dayCount = indexConvention.getDayCount();
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

    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,
        notional, isPayer, businessDayConvention, calendar, isEOM, fixedLegDayCount, conventionalMonthLag, quotationMonthLag, exchangeNotional);
  }
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

      final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDate, startPeriod, businessDayConvention, calendar, isEOM);
      final ZonedDateTime endDate = ScheduleCalculator.getAdjustedDate(startDate, maturityPeriod, businessDayConvention, calendar, isEOM);
      final double accrualFactor = dayCount.getDayCountFraction(startDate, endDate);
      final int spotLag = iborConvention.getSettlementDays();
      final boolean eom = iborConvention.isIsEOM();
      final long months = maturityPeriod.toTotalMonths() - startPeriod.toTotalMonths();
      final Period indexTenor = Period.ofMonths((int) months);
      final IborIndex iborIndex = new IborIndex(currency, indexTenor, spotLag, dayCount, businessDayConvention, eom, convention.getName());
      return new DepositIborDefinition(currency, startDate, endDate, 1, rate, accrualFactor, iborIndex);
    } else {
      throw new OpenGammaRuntimeException("Could not handle convention of type " + convention.getClass());
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

  private FactorExposureData searchForSwapTenorMatch(final Collection<FactorExposureData> exposures, final FixedIncomeStripWithSecurity strip) {
    for (final FactorExposureData exposure : exposures) {
      if (exposure.getFactorType().equals(FactorType.YIELD) && exposure.getFactorName().contains(SWAP_TEXT)) {
        if (exposure.getNode() != null && exposure.getNode().length() > 0) {
          final Period nodePeriod = Period.parse("P" + exposure.getNode());
          if (strip.getTenor().getPeriod().toTotalMonths() == nodePeriod.toTotalMonths()) {
            return exposure;
          }
        }
      }
    }
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

  private FactorExposureData searchForBondTenorMatch(final Collection<FactorExposureData> exposures, final FixedIncomeStripWithSecurity strip) {
    for (final FactorExposureData exposure : exposures) {
      if (exposure.getFactorType().equals(FactorType.YIELD) && exposure.getFactorName().contains(BOND_TEXT)) {
        if (exposure.getNode() != null && exposure.getNode().length() > 0) {
          final Period nodePeriod = Period.parse("P" + exposure.getNode());
          if (strip.getTenor().getPeriod().toTotalMonths() == nodePeriod.toTotalMonths()) {
            return exposure;
          }
        }
      }
    }
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

    final IborIndexConvention indexConvention = _conventionSource.getConvention(IborIndexConvention.class, rateFuture.getUnderlyingConvention());
    if (indexConvention == null) {
      throw new OpenGammaRuntimeException("Underlying convention was null");
    }
    final Period indexTenor = rateFuture.getUnderlyingTenor().getPeriod();
    final double paymentAccrualFactor = indexTenor.toTotalMonths() / 12.; //TODO don't use this method
    final Currency currency = indexConvention.getCurrency();
    final Calendar fixingCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getFixingCalendar());
    final Calendar regionCalendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getRegionCalendar());
    final BusinessDayConvention businessDayConvention = indexConvention.getBusinessDayConvention();
    final DayCount dayCount = indexConvention.getDayCount();
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

      throw new OpenGammaRuntimeException("Could not get market data for " + _dataId);
    }
    final Period startPeriod = fraNode.getFixingStart().getPeriod();
    final Period endPeriod = fraNode.getFixingEnd().getPeriod();
    //TODO probably need a specific FRA convention to hold the reset tenor
    final long months = endPeriod.toTotalMonths() - startPeriod.toTotalMonths();
    final Period indexTenor = Period.ofMonths((int) months);
    final IborIndexConvention indexConvention;
    if (convention instanceof IborIndexConvention) {
      indexConvention = (IborIndexConvention) convention;
    } else {
View Full Code Here

Examples of org.threeten.bp.Period.toTotalMonths()

    return Sets.newHashSet(sabrSurfacesSpecification, smileIdsSpecification);
  }

  private static double getTime(final Tenor tenor) {
    final Period period = tenor.getPeriod();
    final double months = period.toTotalMonths();
    return months / 12.;
  }

  private static ValueRequirement getCubeDataRequirement(final ComputationTarget target, final String cubeName) {
    final ValueProperties cubeProperties = ValueProperties.with(ValuePropertyNames.CUBE, cubeName).get();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.