Package org.threeten.bp

Examples of org.threeten.bp.Period


        return (ChronoLocalDateTime<JapaneseDate>)super.atTime(localTime);
    }

    @Override
    public ChronoPeriod until(ChronoLocalDate endDate) {
        Period period = isoDate.until(endDate);
        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
    }
View Full Code Here


        return (ChronoLocalDateTime<ThaiBuddhistDate>) super.atTime(localTime);
    }

    @Override
    public ChronoPeriod until(ChronoLocalDate endDate) {
        Period period = isoDate.until(endDate);
        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
    }
View Full Code Here

        return (ChronoLocalDateTime<MinguoDate>) super.atTime(localTime);
    }

    @Override
    public ChronoPeriod until(ChronoLocalDate endDate) {
        Period period = isoDate.until(endDate);
        return getChronology().period(period.getYears(), period.getMonths(), period.getDays());
    }
View Full Code Here

    super(tenor);
  }

  /* package */ Tenor toFrequency() {
    try {
      final Period period = Period.parse(getName());
      return Tenor.of(period);
    } catch (DateTimeParseException dpe) {
      throw new OpenGammaRuntimeException("Bad value for tenorBean (" + getName() + ")");
    }
  }
View Full Code Here

    ArgumentChecker.isTrue(tokens.length == 6, "Incorrect number of params for SingleNameIdentifiable");
    final String name = tokens[0];
    final ExternalId reference = ExternalId.of(tokens[1], name);
    final BusinessDayConvention badDayConvention = BusinessDayConventionFactory.of(tokens[2]);
    final DayCount dayCount = DayCountFactory.of(tokens[3]);
    final Period couponFrequency = Period.parse(tokens[4]);
    final StubType stubType = StubType.valueOf(tokens[5]);
    return new SingleNameIdentifiable(name, reference, badDayConvention, dayCount, couponFrequency, stubType);
  }
View Full Code Here


  @Override
  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 {
      if (convention == null) {
View Full Code Here

    final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDateLeg,
                                                                       swapNode.getStartTenor().getPeriod(),
                                                                       businessDayConvention,
                                                                       calendar,
                                                                       eomLeg);
    final Period paymentPeriod = convention.getPaymentTenor().getPeriod();
    final Period maturityTenor = swapNode.getMaturityTenor().getPeriod();

    return Pair.of(new FixedInterestRateLeg(dayCount,
                                            PeriodFrequency.of(paymentPeriod),
                                            convention.getRegionCalendar(),
                                            businessDayConvention,
View Full Code Here

    final Currency currency = indexConvention.getCurrency();
    final DayCount dayCount = indexConvention.getDayCount();
    final BusinessDayConvention businessDayConvention = indexConvention.getBusinessDayConvention();
    final boolean eomIndex = indexConvention.isIsEOM();
    final boolean eomLeg = convention.isIsEOM();
    final Period indexTenor = convention.getResetTenor().getPeriod();
    final Calendar calendar = CalendarUtils.getCalendar(_regionSource,
                                                        _holidaySource,
                                                        indexConvention.getFixingCalendar());
    final int spotLag = indexConvention.getSettlementDays();
    final IborIndex iborIndex = new IborIndex(currency,
                                              indexTenor,
                                              spotLag,
                                              dayCount,
                                              businessDayConvention,
                                              eomIndex,
                                              indexConvention.getName());
    final Period maturityTenor = swapNode.getMaturityTenor().getPeriod();
    final int spotLagLeg = convention.getSettlementDays();
    final ZonedDateTime spotDateLeg = ScheduleCalculator.getAdjustedDate(_valuationTime, spotLagLeg, calendar);
    final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDateLeg,
                                                                       swapNode.getStartTenor().getPeriod(),
                                                                       businessDayConvention,
View Full Code Here

    final Calendar calendar = CalendarUtils.getCalendar(_regionSource,
                                                        _holidaySource,
                                                        indexConvention.getRegionCalendar());
    final int spotLagLeg = convention.getSettlementDays();
    final ZonedDateTime spotDateLeg = ScheduleCalculator.getAdjustedDate(_valuationTime, spotLagLeg, calendar);
    final Period maturityTenor = swapNode.getMaturityTenor().getPeriod();
    final IndexON indexON = new IndexON(indexConvention.getName(), currency, dayCount, publicationLag);
    final Period paymentPeriod = convention.getPaymentTenor().getPeriod();
    final boolean eomLeg = convention.isIsEOM();
    final BusinessDayConvention businessDayConvention = convention.getBusinessDayConvention();
    final int paymentLag = convention.getPaymentLag();
    final ZonedDateTime startDate = ScheduleCalculator.getAdjustedDate(spotDateLeg,
                                                                       swapNode.getStartTenor().getPeriod(),
View Full Code Here

  public CashSecurity visitCashNode(final CashNode cashNode) {
    final Convention convention = _conventionSource.getConvention(cashNode.getConvention());
    if (convention == null) {
      throw new OpenGammaRuntimeException("Convention with id " + cashNode.getConvention() + " was null");
    }
    final Period startPeriod = cashNode.getStartTenor().getPeriod();
    final Period maturityPeriod = cashNode.getMaturityTenor().getPeriod();
    if (convention instanceof DepositConvention) {
      final DepositConvention depositConvention = (DepositConvention) convention;
      final Currency currency = depositConvention.getCurrency();
      final Calendar calendar = CalendarUtils.getCalendar(_regionSource,
                                                          _holidaySource,
                                                          depositConvention.getRegionCalendar());
      final BusinessDayConvention businessDayConvention = depositConvention.getBusinessDayConvention();
      final boolean isEOM = depositConvention.isIsEOM();
      final DayCount dayCount = depositConvention.getDayCount();
      final int settlementDays = depositConvention.getSettlementDays();
      final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(_valuationTime, settlementDays, calendar);
      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);
      return new CashSecurity(currency,
                              depositConvention.getRegionCalendar(),
                              startDate,
                              endDate,
                              dayCount,
                              _rate,
                              _amount);
    } else if (convention instanceof IborIndexConvention) {
      final IborIndexConvention iborConvention = (IborIndexConvention) convention;
      final Currency currency = iborConvention.getCurrency();
      final Calendar calendar = CalendarUtils.getCalendar(_regionSource,
                                                          _holidaySource,
                                                          iborConvention.getRegionCalendar());
      final BusinessDayConvention businessDayConvention = iborConvention.getBusinessDayConvention();
      final boolean isEOM = iborConvention.isIsEOM();
      final DayCount dayCount = iborConvention.getDayCount();
      final int settlementDays = iborConvention.getSettlementDays();
      final ZonedDateTime spotDate = ScheduleCalculator.getAdjustedDate(_valuationTime, settlementDays, calendar);
      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,
View Full Code Here

TOP

Related Classes of org.threeten.bp.Period

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.