Package org.threeten.bp

Examples of org.threeten.bp.LocalDate.plus()


    LocalDate date = obsStartDate;
    while (!date.isAfter(obsEndDate)) {
      if (calendar.isWorkingDay(date)) {
        nGood++;
      }
      date = date.plus(period);
    }
    return nGood;
  }

  @Override
View Full Code Here


    }
    final List<LocalDate> dates = new ArrayList<>();
    LocalDate date = startDate.with(TemporalAdjusters.lastDayOfMonth());
    while (!date.isAfter(endDate)) {
      dates.add(date);
      date = date.plus(Period.ofMonths(1)).with(TemporalAdjusters.lastDayOfMonth());
    }
    return dates.toArray(EMPTY_LOCAL_DATE_ARRAY);
  }

  @Override
View Full Code Here

    }
    LocalDate date = startDate;
    int i = 1;
    while (!date.isAfter(endDate)) {
      dates.add(date);
      date = generateRecursive ? date.plus(Period.ofYears(1)) : startDate.plus(Period.ofYears(i++));
    }
    return dates.toArray(EMPTY_LOCAL_DATE_ARRAY);
  }

  @Override
View Full Code Here

    final ExternalId swapIdentifier = strip.getSecurity();
    final Double rate = marketValues.getDataPoint(swapIdentifier);
    final LocalDate curveDate = spec.getCurveDate();
    final ZonedDateTime tradeDate = curveDate.atTime(11, 00).atZone(ZoneOffset.UTC);
    final ZonedDateTime effectiveDate = DateUtils.previousWeekDay(curveDate.plusDays(3)).atTime(11, 00).atZone(ZoneOffset.UTC);
    final ZonedDateTime maturityDate = curveDate.plus(strip.getMaturity().getPeriod()).atTime(11, 00).atZone(ZoneOffset.UTC);
    final ConventionBundle convention = _conventionBundleSource.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, spec.getCurrency().getCode() + "_TENOR_SWAP"));
    final String counterparty = "";
    final ConventionBundle payLegFloatRateConvention = _conventionBundleSource.getConventionBundle(convention.getBasisSwapPayFloatingLegInitialRate());
    final ConventionBundle receiveLegFloatRateConvention = _conventionBundleSource.getConventionBundle(convention.getBasisSwapReceiveFloatingLegInitialRate());
    final ExternalId payLegFloatRateBloombergTicker = payLegFloatRateConvention.getIdentifiers().getExternalId(ExternalSchemes.BLOOMBERG_TICKER);
View Full Code Here

      final Currency currency) {
    final Collection<FixedIncomeStripWithSecurity> securityStrips = new TreeSet<>();
    final LocalDate curveDate = curveSpecification.getCurveDate();
    for (final FixedIncomeStripWithIdentifier strip : curveSpecification.getStrips()) {
      final ZonedDateTime start = curveDate.atTime(CASH_EXPIRY_TIME).atZone(ZoneOffset.UTC);
      final ZonedDateTime maturity = curveDate.plus(strip.getMaturity().getPeriod()).atTime(CASH_EXPIRY_TIME).atZone(ZoneOffset.UTC);
      final Tenor resolvedTenor = Tenor.of(Period.between(curveDate, maturity.toLocalDate()));
      final CashSecurity security = new CashSecurity(currency, curveSpecification.getRegion(), start, maturity, DAY_COUNT, 0, 0);
      securityStrips.add(new FixedIncomeStripWithSecurity(strip.getStrip(), resolvedTenor, maturity, strip.getSecurity(), security));
    }
    return new InterpolatedYieldCurveSpecificationWithSecurities(curveDate, curveSpecification.getName(), curveSpecification.getCurrency(), curveSpecification.getInterpolator(),
View Full Code Here

    final int n = tenors.length;
    ArgumentChecker.isTrue(isIMMDate(startIMMDate), "start is not an IMM date");
    final LocalDate nextIMM = startIMMDate;
    final LocalDate[] res = new LocalDate[n];
    for (int i = 0; i < n; i++) {
      res[i] = nextIMM.plus(tenors[i]);
    }
    return res;
  }

  /**
 
View Full Code Here

    final LocalDate valueDate = addWorkDays(tradeDate, 3, DEFAULT_CALENDAR);
    final LocalDate nextIMM = getNextIMMDate(tradeDate);
    final int matIndex = 4;
    LocalDate temp = nextIMM;
    for (int i = 0; i < matIndex; i++) {
      temp = temp.plus(PAYMENT_INTERVAL);
    }
    final LocalDate maturity = temp;
    final double coupon = 0.0075;
    final Tenor paymentInt = Tenor.of(PAYMENT_INTERVAL);
View Full Code Here

    LocalDate tMat = nextIMM;
    for (int i = 0; i < nMat; i++) {
      final int steps = i == 0 ? matIndex[0] : matIndex[i] - matIndex[i - 1];
      for (int j = 0; j < steps; j++) {
        tMat = tMat.plus(PAYMENT_INTERVAL);
      }
      maturities[i] = tMat;
    }

    final double[] coupons = new double[] {0.0075, 0.008, 0.01, 0.01, 0.011, 0.01, 0.009 };
View Full Code Here

    LocalDate tMat = nextIMM;
    for (int i = 0; i < nMat; i++) {
      final int steps = i == 0 ? matIndex[0] : matIndex[i] - matIndex[i - 1];
      for (int j = 0; j < steps; j++) {
        tMat = tMat.plus(PAYMENT_INTERVAL);
      }
      maturities[i] = tMat;
    }
    final Tenor paymentInt = Tenor.of(PAYMENT_INTERVAL);
View Full Code Here

      return null;
    }
    Double fixedRate = (fixedRateSeries.getTimeSeries().getEarliestValue() + getRandom().nextDouble()) / 100d;
    Double notional = (double) (getRandom(99999) + 1) * 1000;
    ZonedDateTime tradeDateTime = tradeDate.atStartOfDay(ZoneOffset.UTC);
    ZonedDateTime maturityDateTime = tradeDate.plus(maturity.getPeriod()).atStartOfDay(ZoneOffset.UTC);
    String counterparty = "CParty";
    SwapLeg fixedLeg = new FixedInterestRateLeg(swapConvention.getSwapFixedLegDayCount(),
        swapConvention.getSwapFixedLegFrequency(),
        swapConvention.getSwapFixedLegRegion(),
        swapConvention.getSwapFixedLegBusinessDayConvention(),
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.