Package com.opengamma.financial.security.cash

Examples of com.opengamma.financial.security.cash.CashSecurity$Meta


                                                                       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,
                                                eom,
                                                convention.getName());
      return new CashSecurity(currency,
                              iborConvention.getRegionCalendar(),
                              startDate,
                              endDate,
                              dayCount,
                              _rate,
View Full Code Here


    return bean;
  }

  @Override
  public CashSecurity createSecurity(final OperationContext context, CashSecurityBean bean) {
    final CashSecurity security = new CashSecurity(currencyBeanToCurrency(bean.getCurrency()), externalIdBeanToExternalId(bean.getRegion()),
                                                   zonedDateTimeBeanToDateTimeWithZone(bean.getStart()), zonedDateTimeBeanToDateTimeWithZone(bean.getMaturity()),
                                                   dayCountBeanToDayCount(bean.getDayCount()), bean.getRate(), bean.getAmount());
    return security;
  }
View Full Code Here

    if ((timeSeries == null) || timeSeries.getTimeSeries().isEmpty()) {
      return null;
    }
    final double rate = timeSeries.getTimeSeries().getEarliestValue() * getRandom(0.8, 1.2);
    final double amount = 10000 * (getRandom(1500) + 200);
    final CashSecurity security = new CashSecurity(currency, region, start, maturity, dayCount, rate, amount);
    security.setName(createName(currency, amount, rate, maturity));
    return security;
  }
View Full Code Here

    assertEquals(ExternalId.of(SCHEME, "FUTURE"), ids.get(0));
  }

  @Test
  public void testCashSecurity() {
    final CashSecurity cash = ExposureFunctionTestHelper.getCashSecurity();
    final List<ExternalId> ids = cash.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "CASH"), ids.get(0));
  }
View Full Code Here

    assertEquals(ExternalId.of(SCHEME, "FUTURE_EUR"), ids.get(0));
  }

  @Test
  public void testCashSecurity() {
    final CashSecurity cash = ExposureFunctionTestHelper.getCashSecurity();
    final List<ExternalId> ids = cash.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "CASH_USD"), ids.get(0));
  }
View Full Code Here

    assertNull(ids);
  }

  @Test
  public void testCashSecurity() {
    final CashSecurity cash = ExposureFunctionTestHelper.getCashSecurity();
    final List<ExternalId> ids = cash.accept(EXPOSURE_FUNCTION);
    assertNull(ids);
  }
View Full Code Here

    assertEquals(ExternalId.of(SCHEME, "EUR"), ids.get(0));
  }

  @Test
  public void testCashSecurity() {
    final CashSecurity cash = ExposureFunctionTestHelper.getCashSecurity();
    final List<ExternalId> ids = cash.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "USD"), ids.get(0));
  }
View Full Code Here

    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "34985"));
    return security;
  }

  public static CashSecurity getCashSecurity() {
    final CashSecurity security = new CashSecurity(USD, US, DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2014, 1, 1), DC, 0.01, 10000);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "123"));
    return security;
  }
View Full Code Here

    ExternalId dummyId = ExternalSchemes.bloombergTickerSecurityId("USDRC Curncy");
    ExternalIdBundle bundle = ExternalIdBundle.of(dummyId);
    final ZonedDateTime start = DateUtils.getUTCDate(2011, 9, 30);
    final ZonedDateTime maturity = DateUtils.getUTCDate(2011, 10, 1);
    final DayCount dayCount = DayCountFactory.INSTANCE.getDayCount("Actual/365");
    final CashSecurity cash = new CashSecurity(Currency.USD, ExternalSchemes.financialRegionId("US"), start, maturity, dayCount, 0.05, 1);
    cash.setUniqueId(UniqueId.of("TEST", "TEST"));
    cash.setName("1m deposit rate");
    cash.setExternalIdBundle(bundle);
    final FixedIncomeStripWithSecurity cashStrip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.CASH, Tenor.ONE_MONTH, "DEFAULT"), Tenor.ONE_MONTH, maturity, dummyId, cash);

    dummyId = ExternalSchemes.bloombergTickerSecurityId("EDZ2 Comdty");
    bundle = ExternalIdBundle.of(dummyId);
    final FutureSecurity future = new InterestRateFutureSecurity(new Expiry(ZonedDateTime.now()), "XCSE", "XCSE", Currency.USD, 0, dummyId, "Interest Rate");
View Full Code Here

    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(),
        curveSpecification.interpolateYield(), securityStrips);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.security.cash.CashSecurity$Meta

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.