Package com.opengamma.util.time

Examples of com.opengamma.util.time.Expiry


      throw new OpenGammaRuntimeException(expiryDate + " returned from bloomberg not in format yyyy-mm-dd", e);
    }
    int year = expiryLocalDate.getYear();
    int month = expiryLocalDate.getMonthValue();
    int day = expiryLocalDate.getDayOfMonth();
    Expiry expiry = new Expiry(DateUtils.getUTCDate(year, month, day));
    // TODO kirk 2009-11-03 -- Do something better with the underlying ticker, since we have it.
    /*
    String underlyingTicker = null;
    underlying = underlying.trim();
    if (!underlying.endsWith("Equity") && secType.equals(BLOOMBERG_EQUITY_OPTION_SECURITY_TYPE)) {
View Full Code Here


    if (unitAmount == null) {
      s_logger.warn("Unknown quote units: " + quoteUnits);
      return null;
    }
   
    Expiry expiry = decodeExpiry(expiryDate, futureTradingHours);
    if (expiry == null) {
      s_logger.warn("Unable to decode expiry '" + expiryDate + "' against trading hours '" + futureTradingHours + "'");
      return null;
    }
    Currency currency = Currency.parse(currencyCode);
View Full Code Here

      throw new OpenGammaRuntimeException(expiryDate + " returned from bloomberg not in format yyyy-mm-dd", e);
    }
    int year = expiryLocalDate.getYear();
    int month = expiryLocalDate.getMonthValue();
    int day = expiryLocalDate.getDayOfMonth();
    Expiry expiry = new Expiry(DateUtils.getUTCDate(year, month, day));

    Currency ogCurrency = Currency.parse(currency);

    Set<ExternalId> identifiers = new HashSet<ExternalId>();
    identifiers.add(ExternalSchemes.bloombergBuidSecurityId(bbgUniqueID));
View Full Code Here

        underlying = ExternalSchemes.bloombergTickerSecurityId(underlyingTicker);
      } else {
        underlying = ExternalSchemes.bloombergTickerSecurityId(underlyingTicker + " " + marketSectorDes);
      }
    }
    Expiry expiry = decodeExpiry(expiryDate, futureTradingHours);
    if (expiry == null) {
      return null;
    }
    Expiry settle = decodeExpiry(settleDate, futureTradingHours);
    if (settle == null) {
      s_logger.info("Invalid settlement date, cannot construct equity dividend future security");
      return null;
    }
    Currency currency = Currency.parse(currencyStr);
    EquityIndexDividendFutureSecurity security = new EquityIndexDividendFutureSecurity(expiry, micExchangeCode, micExchangeCode, currency, unitAmount, settle.getExpiry(), underlying, category);
    security.setName(name);
    // set identifiers
    parseIdentifiers(fieldData, security);
    return security;
  }
View Full Code Here

      throw new OpenGammaRuntimeException(expiryDate + " returned from bloomberg not in format yyyy-mm-dd", e);
    }
    int year = expiryLocalDate.getYear();
    int month = expiryLocalDate.getMonthValue();
    int day = expiryLocalDate.getDayOfMonth();
    Expiry expiry = new Expiry(DateUtils.getUTCDate(year, month, day));
    // TODO kirk 2009-11-03 -- Do something better with the underlying ticker, since we have it.
    /*
    String underlyingTicker = null;
    underlying = underlying.trim();
    if (!underlying.endsWith("Equity") && secType.equals(BLOOMBERG_EQUITY_OPTION_SECURITY_TYPE)) {
View Full Code Here

    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");
    future.setExternalIdBundle(bundle);
    final FixedIncomeStripWithSecurity futureStrip = new FixedIncomeStripWithSecurity(new FixedIncomeStrip(StripInstrumentType.FUTURE, Tenor.THREE_MONTHS, 2, "DEFAULT"), Tenor.THREE_MONTHS, DateUtils.getUTCDate(2011, 12, 1), dummyId, future);

    dummyId = ExternalSchemes.bloombergTickerSecurityId("USFR0BE Curncy");
    bundle = ExternalIdBundle.of(dummyId);
View Full Code Here

  @Override
  public FXBarrierOptionSecurity createSecurity(OperationContext context, FXBarrierOptionSecurityBean bean) {
    Currency putCurrency = currencyBeanToCurrency(bean.getPutCurrency());
    Currency callCurrency = currencyBeanToCurrency(bean.getCallCurrency());
    Expiry expiry = expiryBeanToExpiry(bean.getExpiry());
    ZonedDateTime settlementDate = Converters.zonedDateTimeBeanToDateTimeWithZone(bean.getSettlementDate());
    FXBarrierOptionSecurity sec = new FXBarrierOptionSecurity(putCurrency,
        callCurrency,
        bean.getPutAmount(),
        bean.getCallAmount(),
View Full Code Here

    MODEL.getSurface(Collections.<OptionDefinition, Double> emptyMap(), DATA);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullData() {
    MODEL.getSurface(Collections.<OptionDefinition, Double> singletonMap(new EuropeanVanillaOptionDefinition(RANDOM.nextDouble(), new Expiry(DATE), true), 2.3), null);
  }
View Full Code Here

  @Test
  public void test() {
    boolean isCall;
    double spot, strike, b, price;
    Expiry expiry;
    YieldAndDiscountCurve curve;
    EuropeanVanillaOptionDefinition definition;
    StandardOptionDataBundle initialData, data;
    double sigma = 0.01;
    for (int i = 0; i < 100; i++) {
      expiry = new Expiry(DateUtils.getDateOffsetWithYearFraction(DATE, RANDOM.nextDouble() * 2));
      sigma += 0.03;
      spot = 2 * RANDOM.nextDouble() + 10;
      strike = 2 * RANDOM.nextDouble() + 10;
      curve = YieldCurve.from(ConstantDoublesCurve.from(RANDOM.nextDouble() / 10));
      b = 0;//RANDOM.nextDouble() / 20;
View Full Code Here

    assertEquals(OPTION.getLowerBound(), LOWER, 0);
    assertEquals(OPTION.getUpperBound(), UPPER, 0);
    SupershareOptionDefinition other = new SupershareOptionDefinition(EXPIRY, LOWER, UPPER);
    assertEquals(other, OPTION);
    assertEquals(other.hashCode(), OPTION.hashCode());
    other = new SupershareOptionDefinition(new Expiry(DateUtils.getUTCDate(2011, 1, 1)), LOWER, UPPER);
    assertFalse(other.equals(OPTION));
    other = new SupershareOptionDefinition(EXPIRY, LOWER + 1, UPPER);
    assertFalse(other.equals(OPTION));
    other = new SupershareOptionDefinition(EXPIRY, LOWER, UPPER + 1);
    assertFalse(other.equals(OPTION));
View Full Code Here

TOP

Related Classes of com.opengamma.util.time.Expiry

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.