Examples of ZonedDateTime


Examples of org.threeten.bp.ZonedDateTime

    return bean;
  }

  @Override
  public FXForwardSecurity createSecurity(final OperationContext context, FXForwardSecurityBean bean) {
    ZonedDateTime forwardDate = zonedDateTimeBeanToDateTimeWithZone(bean.getForwardDate());
    ExternalId region = externalIdBeanToExternalId(bean.getRegion());
    Currency payCurrency = currencyBeanToCurrency(bean.getPayCurrency());
    double payAmount = bean.getPayAmount();
    Currency receiveCurrency = currencyBeanToCurrency(bean.getReceiveCurrency());
    double receiveAmount = bean.getReceiveAmount();
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

  @Override
  public CapFloorCMSSpreadSecurity createSecurity() {
    final Currency currency = getRandomCurrency();
    final boolean payer = getRandom().nextBoolean();
    final boolean cap = getRandom().nextBoolean();
    final ZonedDateTime startDate = previousWorkingDay(ZonedDateTime.now().minusDays(getRandom(365) + 7), currency);
    final double notional = (double) getRandom(100000) * 1000;
    Tenor tenor1;
    Tenor tenor2;
    do {
      tenor1 = getRandom(SHORT_TENORS);
      tenor2 = getRandom(LONG_TENORS);
    } while (tenor1.compareTo(tenor2) >= 0);
    final int length = getRandom(tenor2.getPeriod().getYears() - 5) + 3;
    final ZonedDateTime maturityDate = nextWorkingDay(startDate.plusYears(length), currency);
    final ExternalId shortIdentifier = getUnderlying(currency, startDate.toLocalDate(), tenor1);
    final ExternalId longIdentifier = getUnderlying(currency, startDate.toLocalDate(), tenor2);
    final double strike = getRandom(STRIKES);
    final Frequency frequency = getRandom(FREQUENCY);
    final DayCount dayCount = getRandom(DAY_COUNT);
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

//    persistToPortfolio(Arrays.asList(vanillaSwaps, oisSwaps, basisSwaps, futures), Arrays.asList("EUR Vanilla Swaps", "EUR OIS Swaps", "EUR 3m/6m Basis Swaps", "STIR Futures"), PORTFOLIO_NAME);   
    persistToPortfolio(Arrays.asList(vanillaSwaps, oisSwaps, basisSwaps), Arrays.asList("EUR Vanilla Swaps", "EUR OIS Swaps", "EUR 3m/6m Basis Swaps"), PORTFOLIO_NAME);
  }

  private Collection<FinancialSecurity> getVanillaSwapSecurities(final Random random) {
    final ZonedDateTime tradeDate = DateUtils.getUTCDate(2013, 8, 1);
    final ZonedDateTime effectiveDate = DateUtils.getUTCDate(2013, 8, 5);
    final Collection<FinancialSecurity> securities = new ArrayList<>();
    for (int i = 0; i < N_VANILLA_SWAPS; i++) {
      final InterestRateNotional notional = new InterestRateNotional(CURRENCY, 10000000 * (1 + random.nextInt(9)));
      final int years = 1 + random.nextInt(30);
      final ZonedDateTime maturityDate = tradeDate.plusYears(years);
      final double rate = years * 0.001 + random.nextDouble() / 5000;
      final FixedInterestRateLeg fixedLeg = new FixedInterestRateLeg(ACT_360, SEMI_ANNUAL, REGION, MODIFIED_FOLLOWING, notional, false, rate);
      final Frequency frequency;
      final ExternalId euribor;
      final String frequencyLabel;
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

    }
    return securities;
  }

  private Collection<FinancialSecurity> getOISSwapSecurities(final Random random) {
    final ZonedDateTime tradeDate = DateUtils.getUTCDate(2013, 8, 1);
    final ZonedDateTime effectiveDate = DateUtils.getUTCDate(2013, 8, 5);
    final Collection<FinancialSecurity> securities = new ArrayList<>();
    for (int i = 0; i < N_OIS_SWAPS; i++) {
      final InterestRateNotional notional = new InterestRateNotional(CURRENCY, 10000000 * (1 + random.nextInt(9)));
      final int years = 1 + random.nextInt(30);
      final ZonedDateTime maturityDate = tradeDate.plusYears(years);
      final double rate = years * 0.001 + random.nextDouble() / 5000;
      final FixedInterestRateLeg fixedLeg = new FixedInterestRateLeg(ACT_360, SEMI_ANNUAL, REGION, MODIFIED_FOLLOWING, notional, false, rate);
      final Frequency frequency;
      if (random.nextBoolean()) {
        frequency = QUARTERLY;
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

    }
    return securities;
  }

  private Collection<FinancialSecurity> getBasisSwapSecurities(final Random random) {
    final ZonedDateTime tradeDate = DateUtils.getUTCDate(2013, 8, 1);
    final ZonedDateTime effectiveDate = DateUtils.getUTCDate(2013, 8, 5);
    final Collection<FinancialSecurity> securities = new ArrayList<>();
    for (int i = 0; i < N_BASIS_SWAPS; i++) {
      final InterestRateNotional notional = new InterestRateNotional(CURRENCY, 10000000 * (1 + random.nextInt(9)));
      final int years = 1 + random.nextInt(30);
      final ZonedDateTime maturityDate = tradeDate.plusYears(years);
      final double spread = years * 0.002 + random.nextDouble() / 1000.;
      final Frequency payFrequency, receiveFrequency;
      final ExternalId payRate, receiveRate;
      final FloatingInterestRateLeg payLeg, receiveLeg;
      final String frequencyLabel;
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

    }
    return securities;
  }

  private Collection<FinancialSecurity> getIRFutureSecurities(final Random random) {
    final ZonedDateTime tradeDate = DateUtils.getUTCDate(2014, 9, 1);
    final Collection<FinancialSecurity> securities = new ArrayList<>();
    final int[] amounts = new int[N_FUTURES];
    final double[] prices = new double[N_FUTURES];
    for (int i = 0; i < N_FUTURES; i++) {
      final int n = 1 + random.nextInt(5);
      final Expiry expiry = new Expiry(tradeDate.plusMonths(3 * n).with(THIRD_WED_ADJUSTER));
      final String letter = MONTHS.get(expiry.getExpiry().getMonth());
      final String year = Integer.toString(expiry.getExpiry().getYear() - 2010);
      final String code = "ER" + letter + year;
      final FutureSecurity security = new InterestRateFutureSecurity(expiry, "XLIF", "XLIF", CURRENCY, 2500, EURIBOR_3M, "Interest rate");
      security.setName(code);
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

  }

  @Override
  public SwaptionSecurity createSecurity() {
    final int optionLength = getRandom(OPTION_LENGTH);
    ZonedDateTime expiry = ZonedDateTime.now().plusMonths(optionLength);
    final SwapSecurity underlying = createUnderlying(expiry.plusMonths(2), expiry);
    final Currency currency = FinancialSecurityUtils.getCurrency(underlying);
    expiry = nextWorkingDay(expiry, currency);
    final boolean isPayer = getRandom().nextBoolean();
    final boolean isLong = getRandom().nextBoolean();
    final boolean isCashSettled = getRandom().nextBoolean();
    final ZonedDateTime settlementDate = nextWorkingDay(expiry.plusDays(2), currency);
    final Double notional = underlying.getPayLeg().getNotional().accept(new NotionalVisitor<Double>() {

      @Override
      public Double visitCommodityNotional(final CommodityNotional notional) {
        return null;
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

    assertEquals(SamplingFrequency.ONE_LOOK, _stringConvert.convertFromString(SamplingFrequency.class, "One Look"));
  }

  @Test
  public void convertZonedDateTime() {
    ZonedDateTime date = LocalDate.of(2012, 12, 21).atTime(11, 0).atZone(ZoneId.of("UTC"));
    assertEquals("2012-12-21", _stringConvert.convertToString(date));
    assertEquals(date, _stringConvert.convertFromString(ZonedDateTime.class, "2012-12-21"));
  }
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

  /**
   * BondFutureSecurity contains a collection of bean instances (BondFutureDeliverable)
   */
  @Test
  public void bondFuture() throws JSONException {
    ZonedDateTime firstDeliveryDate = zdt(2012, 12, 21, 11, 0, 0, 0, ZoneOffset.UTC);
    ZonedDateTime lastDeliveryDate = zdt(2013, 12, 21, 11, 0, 0, 0, ZoneOffset.UTC);
    ZonedDateTime expiryDate = zdt(2013, 12, 22, 11, 0, 0, 0, ZoneOffset.UTC);
    ExternalIdBundle bundle1 = ExternalIdBundle.of(ExternalId.of("sch1", "123"), ExternalId.of("sch1", "234"));
    ExternalIdBundle bundle2 = ExternalIdBundle.of(ExternalId.of("sch1", "345"));
    List<BondFutureDeliverable> basket = Lists.newArrayList(
        new BondFutureDeliverable(bundle1, 111),
        new BondFutureDeliverable(bundle2, 222));
View Full Code Here

Examples of org.threeten.bp.ZonedDateTime

  protected FXBarrierOptionSecurity createFXBarrierOptionSecurity(final Bundle bundle) {
    final Currency putCurrency = bundle._firstCurrency;
    final Currency callCurrency = bundle._secondCurrency;
    final double putAmount = putCurrency.equals(Currency.JPY) ? NOTIONAL * 100 : NOTIONAL;
    final ZonedDateTime settlementDate = nextWorkingDay(bundle._tradeDate.plusDays(bundle._daysOffset), bundle._firstCurrency, bundle._secondCurrency);
    final Expiry expiry = new Expiry(settlementDate, ExpiryAccuracy.DAY_MONTH_YEAR);
    final Double fxRate = getApproxFXRate(settlementDate.toLocalDate(), Pair.of(bundle._firstCurrency, bundle._secondCurrency));
    if (fxRate == null) {
      return null;
    }
    final double callAmount = NOTIONAL * fxRate;
    final String dateString = settlementDate.toString(DATE_FORMATTER);
    final BarrierType barrierType = bundle._up ? BarrierType.UP : BarrierType.DOWN;
    final BarrierDirection barrierDirection = BarrierDirection.KNOCK_IN;
    final MonitoringType monitoringType = MonitoringType.CONTINUOUS;
    final SamplingFrequency samplingFrequency = SamplingFrequency.DAILY_CLOSE;
    final boolean invertBarrierLevel = !CurrencyPair.of(putCurrency, callCurrency).equals(getCurrencyPair(putCurrency, callCurrency));
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.