Package org.threeten.bp

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


    ArgumentChecker.notNull(calendar, "calendar");
    LocalDate date = firstDate;
    while (!calendar.isWorkingDay(date)) {
      date = date.plusDays(1);
    }
    date = date.plusDays(1);
    int count = 0;
    while (!date.isAfter(secondDate)) {
      if (calendar.isWorkingDay(date)) {
        count++;
      }
View Full Code Here


    int count = 0;
    while (!date.isAfter(secondDate)) {
      if (calendar.isWorkingDay(date)) {
        count++;
      }
      date = date.plusDays(1);
    }
    return count / 252.;
  }

  @Override
View Full Code Here

   
    ManageablePosition position = new ManageablePosition(BigDecimal.TEN, ExternalId.of("A", "B"));
    ManageableTrade trade = new ManageableTrade(BigDecimal.TEN, ExternalId.of("A", "B"), tradeDate, tradeTime, ExternalId.of("CPS", "CPV"));
    trade.setPremium(1000000.00);
    trade.setPremiumCurrency(Currency.USD);
    trade.setPremiumDate(tradeDate.plusDays(1));
    trade.setPremiumTime(tradeTime);
    position.getTrades().add(trade);
   
    PositionDocument doc = new PositionDocument();
    doc.setPosition(position);
View Full Code Here

    assertEquals(tradeTime, testTrade.getTradeTime());
    assertEquals(ExternalId.of("CPS", "CPV"), testTrade.getCounterpartyExternalId());
    assertEquals(secKey, testTrade.getSecurityLink().getExternalId());
    assertEquals(1000000.00, testTrade.getPremium());
    assertEquals(Currency.USD, testTrade.getPremiumCurrency());
    assertEquals(tradeDate.plusDays(1), testTrade.getPremiumDate());
    assertEquals(tradeTime, testTrade.getPremiumTime());
  }

  @Test
  public void test_addWithOnePremiumTrade_addThenGet() {
View Full Code Here

    OffsetTime tradeTime = _now.toOffsetTime().minusSeconds(500);
   
    ManageableTrade trade = new ManageableTrade(BigDecimal.TEN, ExternalId.of("A", "B"), tradeDate, tradeTime, ExternalId.of("CPS", "CPV"));
    trade.setPremium(1000000.00);
    trade.setPremiumCurrency(Currency.USD);
    trade.setPremiumDate(tradeDate.plusDays(1));
    trade.setPremiumTime(tradeTime);
   
    position.getTrades().add(trade);
   
    PositionDocument doc = new PositionDocument();
View Full Code Here

    LocalDate date = LocalDate.of(2012, 6, 30);
    for (int i = 0; i < 600; i++) {
      bld.put(date, i);
      outDates[i] = LocalDateToIntConverter.convertToInt(date);
      outValues[i] = i;
      date = date.plusDays(1);
    }
    assertEquals(ImmutableLocalDateDoubleTimeSeries.of(outDates, outValues), bld.build());
  }

  //-------------------------------------------------------------------------
View Full Code Here

    OffsetTime tradeTime = _now.toOffsetTime().minusSeconds(500);
   
    ManageableTrade trade1 = new ManageableTrade(BigDecimal.TEN, ExternalId.of("A", "B"), tradeDate, tradeTime, ExternalId.of("CPS", "CPV"));
    trade1.setPremium(1000000.00);
    trade1.setPremiumCurrency(Currency.USD);
    trade1.setPremiumDate(tradeDate.plusDays(1));
    trade1.setPremiumTime(tradeTime);
    position.getTrades().add(trade1);
   
    ManageableTrade trade2 = new ManageableTrade(BigDecimal.TEN, ExternalId.of("C", "D"), tradeDate, tradeTime, ExternalId.of("CPS2", "CPV2"));
    trade2.setPremium(100.00);
View Full Code Here

    position.getTrades().add(trade1);
   
    ManageableTrade trade2 = new ManageableTrade(BigDecimal.TEN, ExternalId.of("C", "D"), tradeDate, tradeTime, ExternalId.of("CPS2", "CPV2"));
    trade2.setPremium(100.00);
    trade2.setPremiumCurrency(Currency.GBP);
    trade2.setPremiumDate(tradeDate.plusDays(10));
    trade2.setPremiumTime(tradeTime.plusHours(1));
    position.getTrades().add(trade2);
   
    PositionDocument doc = new PositionDocument();
    doc.setPosition(position);
View Full Code Here

    int loop = 10_000_000 / size;
    LocalDate base = LocalDate.now().minusYears(2);
    LocalDate[] dates = new LocalDate[size];
    double[] values = new double[size];
    for (int i = 0; i < size; i++) {
      dates[i] = base.plusDays(i);
      values[i] = i * 1.2d;
    }
    DoubleTimeSeries<LocalDate> ts = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
    long start = System.nanoTime();
    for (int j = 0; j < loop; j++) {
View Full Code Here

    LocalDate[] dates1 = new LocalDate[size];
    double[] values1 = new double[size];
    LocalDate[] dates2 = new LocalDate[size];
    double[] values2 = new double[size];
    for (int i = 0; i < size; i++) {
      dates1[i] = base.plusDays(i);
      values1[i] = i * 1.2d;
      dates2[i] = base.plusDays(i);
      values2[i] = i * 1.5d;
    }
    DoubleTimeSeries<LocalDate> ts1 = ImmutableLocalDateDoubleTimeSeries.of(dates1, values1);
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.