Package com.opengamma.analytics.financial.interestrate.future.derivative

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.BondFuturesSecurity


  @Override
  public BondFuturesTransaction toDerivative(final ZonedDateTime date, final Double lastMarginPrice, final String... yieldCurveNames) {
    ArgumentChecker.notNull(date, "date");
    ArgumentChecker.isTrue(!date.isAfter(getUnderlyingFuture().getDeliveryLastDate()), "Date is after last delivery date");
    ArgumentChecker.isTrue(!date.isBefore(_tradeDate), "Date is before trade date");
    final BondFuturesSecurity underlyingFuture = _underlyingFuture.toDerivative(date, yieldCurveNames);
    double referencePrice;
    if (_tradeDate.isBefore(date)) { // Transaction was before last margining.
      referencePrice = lastMarginPrice;
    } else { // Transaction is today
      referencePrice = _tradePrice;
View Full Code Here


  @Override
  public BondFuturesTransaction toDerivative(final ZonedDateTime date, final Double lastMarginPrice) {
    ArgumentChecker.notNull(date, "date");
    ArgumentChecker.isTrue(!date.isAfter(getUnderlyingFuture().getDeliveryLastDate()), "Date is after last delivery date");
    ArgumentChecker.isTrue(!date.isBefore(_tradeDate), "Date is before trade date");
    final BondFuturesSecurity underlyingFuture = _underlyingFuture.toDerivative(date);
    double referencePrice;
    if (_tradeDate.isBefore(date)) { // Transaction was before last margining.
      referencePrice = lastMarginPrice;
    } else { // Transaction is today
      referencePrice = _tradePrice;
View Full Code Here

    final double lastDeliveryTime = actAct.getDayCountFraction(date, getDeliveryLastDate(), _calendar);
    final BondFixedSecurity[] basket = new BondFixedSecurity[_deliveryBasket.length];
    for (int loopbasket = 0; loopbasket < _deliveryBasket.length; loopbasket++) {
      basket[loopbasket] = _deliveryBasket[loopbasket].toDerivative(date, _deliveryLastDate, yieldCurveNames);
    }
    return new BondFuturesSecurity(lastTradingTime, firstNoticeTime, lastNoticeTime, firstDeliveryTime, lastDeliveryTime, _notional, basket, _conversionFactor);
  }
View Full Code Here

    final double lastDeliveryTime = actAct.getDayCountFraction(date, getDeliveryLastDate(), _calendar);
    final BondFixedSecurity[] basket = new BondFixedSecurity[_deliveryBasket.length];
    for (int loopbasket = 0; loopbasket < _deliveryBasket.length; loopbasket++) {
      basket[loopbasket] = _deliveryBasket[loopbasket].toDerivative(date, _deliveryLastDate);
    }
    return new BondFuturesSecurity(lastTradingTime, firstNoticeTime, lastNoticeTime, firstDeliveryTime, lastDeliveryTime, _notional, basket, _conversionFactor);
  }
View Full Code Here

    final String creditCruveName = "Credit";
    final String repoCurveName = "Repo";
    final String[] curvesName = {creditCruveName, repoCurveName };
    final double lastMarginPrice = 1.0234;
    final BondFuturesTransaction futureConverted = FUTURE_TRANSACTION_DEFINITION.toDerivative(referenceDate, lastMarginPrice, curvesName);
    final BondFuturesSecurity security = FUTURE_DEFINITION.toDerivative(referenceDate, curvesName);
    final BondFuturesTransaction futureConstructed = new BondFuturesTransaction(security, QUANTITY, TRADE_PRICE);
    assertEquals("Bond future transaction definition: to derivative", futureConstructed, futureConverted);
  }
View Full Code Here

    final String creditCruveName = "Credit";
    final String repoCurveName = "Repo";
    final String[] curvesName = {creditCruveName, repoCurveName };
    final double lastMarginPrice = 1.0234;
    final BondFuturesTransaction futureConverted = FUTURE_TRANSACTION_DEFINITION.toDerivative(referenceDate, lastMarginPrice, curvesName);
    final BondFuturesSecurity security = FUTURE_DEFINITION.toDerivative(referenceDate, curvesName);
    final BondFuturesTransaction futureConstructed = new BondFuturesTransaction(security, QUANTITY, lastMarginPrice);
    assertEquals("Bond future transaction definition: to derivative", futureConstructed, futureConverted);
  }
View Full Code Here

   */
  public void toDerivativeOnTradeDate() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 6, 21);
    final double lastMarginPrice = 1.0234;
    final BondFuturesTransaction futureConverted = FUTURE_TRANSACTION_DEFINITION.toDerivative(referenceDate, lastMarginPrice);
    final BondFuturesSecurity security = FUTURE_DEFINITION.toDerivative(referenceDate);
    final BondFuturesTransaction futureConstructed = new BondFuturesTransaction(security, QUANTITY, TRADE_PRICE);
    assertEquals("Bond future transaction definition: to derivative", futureConstructed, futureConverted);
  }
View Full Code Here

   */
  public void toDerivativeAfterTradeDate() {
    final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 6, 22);
    final double lastMarginPrice = 1.0234;
    final BondFuturesTransaction futureConverted = FUTURE_TRANSACTION_DEFINITION.toDerivative(referenceDate, lastMarginPrice);
    final BondFuturesSecurity security = FUTURE_DEFINITION.toDerivative(referenceDate);
    final BondFuturesTransaction futureConstructed = new BondFuturesTransaction(security, QUANTITY, lastMarginPrice);
    assertEquals("Bond future transaction definition: to derivative", futureConstructed, futureConverted);
  }
View Full Code Here

    final String[] curvesName = {creditCruveName, repoCurveName };
    final BondFixedSecurity[] basket = new BondFixedSecurity[NB_BOND];
    for (int loopbasket = 0; loopbasket < NB_BOND; loopbasket++) {
      basket[loopbasket] = BASKET_DEFINITION[loopbasket].toDerivative(referenceDate, lastDeliveryDate, curvesName);
    }
    final BondFuturesSecurity futureConverted = FUTURE_DEFINITION.toDerivative(referenceDate, curvesName);
    final BondFuturesSecurity futureExpected = new BondFuturesSecurity(lastTradingTime, firstNoticeTime, lastNoticeTime, firstDeliveryTime, lastDeliveryTime, NOTIONAL, basket, CONVERSION_FACTOR);
    assertEquals("Bond future security definition: future conversion", futureExpected, futureConverted);
  }
View Full Code Here

    final double lastDeliveryTime = actAct.getDayCountFraction(referenceDate, lastDeliveryDate);
    final BondFixedSecurity[] basket = new BondFixedSecurity[NB_BOND];
    for (int loopbasket = 0; loopbasket < NB_BOND; loopbasket++) {
      basket[loopbasket] = BASKET_DEFINITION[loopbasket].toDerivative(referenceDate, lastDeliveryDate);
    }
    final BondFuturesSecurity futureConverted = FUTURE_DEFINITION.toDerivative(referenceDate);
    final BondFuturesSecurity futureExpected = new BondFuturesSecurity(lastTradingTime, firstNoticeTime, lastNoticeTime, firstDeliveryTime, lastDeliveryTime, NOTIONAL, basket, CONVERSION_FACTOR);
    assertEquals("Bond future security definition: future conversion", futureExpected, futureConverted);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.future.derivative.BondFuturesSecurity

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.