Package com.opengamma.util.time

Examples of com.opengamma.util.time.Expiry


    @Override
    public SimpleChooserPayoffStyle buildObject(FudgeDeserializer deserializer, FudgeMsg msg) {
      ZonedDateTime chooseDate = ZonedDateTimeFudgeBuilder.fromFudgeMsg(deserializer, msg.getMessage(CHOOSE_DATE_FIELD_NAME));
      double strike = msg.getDouble(UNDERLYING_STRIKE_FIELD_NAME);
      Expiry expiry = ExpiryFudgeBuilder.fromFudgeMsg(deserializer, msg.getMessage(UNDERLYING_EXPIRY_FIELD_NAME));
      return new SimpleChooserPayoffStyle(chooseDate, strike, expiry);
    }
View Full Code Here


      final int nodes = RecombiningBinomialTree.NODES.evaluate(i);
      final BinomialOptionModel<StandardOptionDataBundle> crrModel = new BinomialOptionModel<>(CRR, i);
      t += dt;
      final double df1 = Math.exp(dt * data.getInterestRate(t));
      final double df2 = Math.exp(dt * data.getCostOfCarry());
      final Expiry expiry = new Expiry(DateUtils.getDateOffsetWithYearFraction(date, t));
      final int mid = i / 2;
      if (i % 2 == 0) {
        impliedTree[i][mid] = spot;
        addUpperNodes(data, impliedTree, arrowDebreu, i, crrModel, df1, df2, expiry, mid + 1);
        addLowerNodes(data, impliedTree, arrowDebreu, i, crrModel, df1, df2, expiry, mid - 1);
View Full Code Here

    final double q2 = 2;
    final EuropeanExchangeAssetOptionDefinition option = new EuropeanExchangeAssetOptionDefinition(EXPIRY, q1, q2);
    EuropeanExchangeAssetOptionDefinition other = new EuropeanExchangeAssetOptionDefinition(EXPIRY, q1, q2);
    assertEquals(option, other);
    assertEquals(option.hashCode(), other.hashCode());
    other = new EuropeanExchangeAssetOptionDefinition(new Expiry(DateUtils.getUTCDate(2011, 2, 1)), q1, q2);
    assertFalse(option.equals(other));
    other = new EuropeanExchangeAssetOptionDefinition(EXPIRY, q1 + q2, q2);
    assertFalse(option.equals(other));
    other = new EuropeanExchangeAssetOptionDefinition(EXPIRY, q1, q1 + q2);
    assertFalse(option.equals(other));
View Full Code Here

  //-------------------------------------------------------------------------
  @Test(enabled = false)
  public void test_bond() throws Exception {
    ZonedDateTime zdt = ZonedDateTime.parse("2011-01-31T12:00Z[Europe/London]");
    GovernmentBondSecurity sec = new GovernmentBondSecurity("US TREASURY N/B", "issuerType", "issuerDomicile", "market",
        Currency.GBP, SimpleYieldConvention.US_TREASURY_EQUIVALANT, new Expiry(zdt),
        "couponType", 23.5d, SimpleFrequency.ANNUAL, DayCountFactory.INSTANCE.getDayCount("Act/Act"),
        zdt, zdt, zdt, 129d, 1324d, 12d, 1d, 2d, 3d);
    sec.addExternalId(ExternalId.of("abc", "def"));
    SecurityDocument addDoc = new SecurityDocument(sec);
    SecurityDocument added = _secMaster.add(addDoc);
View Full Code Here

    }
    final SwapSecurity swap = new SwapSecurity(swaptionExpiry, swaptionExpiry.plusDays(2), swapMaturity, COUNTERPARTY, payLeg, receiveLeg);
    swap.setName(swapName);
    final ExternalId underlyingId = ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString());
    swap.addExternalId(underlyingId);
    final SwaptionSecurity swaption = new SwaptionSecurity(payer, underlyingId, isLong, new Expiry(swaptionExpiry), isCashSettled, ccy);
    swaption.setName(swaptionName);
    swaption.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    return Pair.of(swaption, swap);
  }
View Full Code Here

   * Get US bond future security for testing
   *
   * @return the bond future security
   */
  public static BondFutureSecurity getBondFutureSecurity() {
    Expiry expiry = new Expiry(ZonedDateTime.of(LocalDateTime.of(2010, Month.JUNE, 21, 19, 0),
        ZoneOffset.UTC), ExpiryAccuracy.MIN_HOUR_DAY_MONTH_YEAR);
    Set<BondFutureDeliverable> basket = new HashSet<BondFutureDeliverable>();
    basket.add(new BondFutureDeliverable(ExternalIdBundle.of(
        ExternalSchemes.bloombergBuidSecurityId("GV912810EV6")), 1.0858));
    basket.add(new BondFutureDeliverable(ExternalIdBundle.of(
View Full Code Here

    //TODO do we need to check that the swaption expiry is consistent with the underlying swap?
    _underlyingSwap = underlyingSwap;
    _currency = underlyingSwap.getCurrency();
    _isLong = isLong;
    _settlementDate = underlyingSwap.getFixedLeg().getNthPayment(0).getAccrualStartDate();
    _expiry = new Expiry(expiryDate);
  }
View Full Code Here

    ArgumentChecker.notNull(underlyingSwap, "underlying swap");
    ArgumentChecker.isTrue(isCall == underlyingSwap.getFixedLeg().isPayer(), "Call flag not in line with underlying");
    _underlyingSwap = underlyingSwap;
    _currency = underlyingSwap.getCurrency();
    _isLong = isLong;
    _expiry = new Expiry(expiryDate);
  }
View Full Code Here

        final double t2 = definition.getUnderlyingOption().getTimeToExpiry(date);
        final double deltaT = t2 - t1;
        final double sigma = data.getVolatility(t1, k1); //REVIEW emcleod 20-7-10 This will work with a flat volatility surface but otherwise will give odd results
        final double r = data.getInterestRate(t1);
        final double b = data.getCostOfCarry();
        final double criticalValue = getCriticalValue(new EuropeanVanillaOptionDefinition(k2, new Expiry(DateUtils.getDateOffsetWithYearFraction(date, deltaT)), underlying.isCall()), data, k1);
        final double d1 = getD1(s, criticalValue, t1, sigma, b);
        final double d2 = getD2(d1, sigma, t1);
        final double d3 = getD1(s, k2, t2, sigma, b);
        final double d4 = getD2(d3, sigma, t2);
        if (definition.isCall()) {
View Full Code Here

    final CouponFixedAccruedCompoundingDefinition firstPayment = underlyingSwap.getFixedLeg().getNthPayment(0);
    _underlyingSwap = underlyingSwap;
    _currency = underlyingSwap.getCurrency();
    _isLong = isLong;
    _settlementDate = underlyingSwap.getFixedLeg().getNthPayment(0).getAccrualStartDate();
    _expiry = new Expiry(expiryDate);
    _strike = firstPayment.getRate();
    _isCall = isCall;
  }
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.