Package com.opengamma.analytics.financial.interestrate

Examples of com.opengamma.analytics.financial.interestrate.InstrumentDerivative.accept()


    final InstrumentDerivative instrumentTomorrow = definition.toDerivative(horizonDate, yieldCurveNames);
    final MultipleCurrencyAmount paymentToday = instrumentToday.accept(paymentCalculator);
    final YieldCurveBundle shiftedCurves = CURVES_ROLLDOWN.rollDown(data, shiftTime);
    final SmileDeltaTermStructureDataBundle tomorrowData = data.with(shiftedCurves);
    final PresentValueBlackSmileForexCalculator pvCalculator = PresentValueBlackSmileForexCalculator.getInstance();
    return subtract(instrumentTomorrow.accept(pvCalculator, tomorrowData), instrumentToday.accept(pvCalculator, data)).plus(paymentToday);
  }

  private MultipleCurrencyAmount subtract(final MultipleCurrencyAmount a, final MultipleCurrencyAmount b) {
    return a.plus(b.multipliedBy(-1));
  }
View Full Code Here


        return volatilityData.getVolatility(time + shiftTime, strike, forward);
      }
    };
    final SmileDeltaTermStructureDataBundle tomorrowData = data.with(smile);
    final PresentValueBlackSmileForexCalculator pvCalculator = PresentValueBlackSmileForexCalculator.getInstance();
    return subtract(instrumentTomorrow.accept(pvCalculator, tomorrowData), instrumentToday.accept(pvCalculator, data)).plus(paymentToday);
  }

  private MultipleCurrencyAmount subtract(final MultipleCurrencyAmount a, final MultipleCurrencyAmount b) {
    return a.plus(b.multipliedBy(-1));
  }
View Full Code Here

    final List<ZonedDateTime> receiveDates = instrument.accept(RECEIVE_DATES, date);
    final List<MultipleCurrencyAmount> payCashFlows = new ArrayList<>();
    final List<MultipleCurrencyAmount> receiveCashFlows = new ArrayList<>();
    final InstrumentDerivative derivative = instrument.toDerivative(date, yieldCurveNames);
    if (payDates != null) {
      payCashFlows.addAll(derivative.accept(ProjectedPayCashFlowVisitor.getInstance(), data));
      if (payCashFlows.size() != payDates.size()) {
        throw new IllegalStateException("Did not have same number of payments as dates");
      }
    }
    if (receiveDates != null) {
View Full Code Here

      if (payCashFlows.size() != payDates.size()) {
        throw new IllegalStateException("Did not have same number of payments as dates");
      }
    }
    if (receiveDates != null) {
      receiveCashFlows.addAll(derivative.accept(ProjectedReceiveCashFlowVisitor.getInstance(), data));
      if (receiveCashFlows.size() != receiveDates.size()) {
        throw new IllegalStateException("Did not have same number of receive payments as dates");
      }
    }
    return add(payCashFlows, payDates, receiveCashFlows, receiveDates);
View Full Code Here

    final List<ZonedDateTime> receiveDates = instrument.accept(RECEIVE_DATES, date);
    final List<MultipleCurrencyAmount> payCashFlows = new ArrayList<>();
    final List<MultipleCurrencyAmount> receiveCashFlows = new ArrayList<>();
    final InstrumentDerivative derivative = instrument.toDerivative(date);
    if (payDates != null) {
      payCashFlows.addAll(derivative.accept(ProjectedPayCashFlowVisitor.getInstance(), data));
      if (payCashFlows.size() != payDates.size()) {
        throw new IllegalStateException("Did not have same number of payments as dates");
      }
    }
    if (receiveDates != null) {
View Full Code Here

      if (payCashFlows.size() != payDates.size()) {
        throw new IllegalStateException("Did not have same number of payments as dates");
      }
    }
    if (receiveDates != null) {
      receiveCashFlows.addAll(derivative.accept(ProjectedReceiveCashFlowVisitor.getInstance(), data));
      if (receiveCashFlows.size() != receiveDates.size()) {
        throw new IllegalStateException("Did not have same number of receive payments as dates");
      }
    }
    return add(payCashFlows, payDates, receiveCashFlows, receiveDates);
View Full Code Here

    final TodayPaymentCalculator paymentCalculator = TodayPaymentCalculator.getInstance(shiftTime);
    final InstrumentDerivative instrumentTomorrow = definition.toDerivative(horizonDate, yieldCurveNames);
    final MultipleCurrencyAmount paymentToday = instrumentToday.accept(paymentCalculator);
    final SmileDeltaTermStructureDataBundle tomorrowData = data.with(data);
    final PresentValueBlackSmileForexCalculator pvCalculator = PresentValueBlackSmileForexCalculator.getInstance();
    return subtract(instrumentTomorrow.accept(pvCalculator, tomorrowData), instrumentToday.accept(pvCalculator, data)).plus(paymentToday);
  }

  private MultipleCurrencyAmount subtract(final MultipleCurrencyAmount a, final MultipleCurrencyAmount b) {
    return a.plus(b.multipliedBy(-1));
  }
View Full Code Here

    final TodayPaymentCalculator paymentCalculator = TodayPaymentCalculator.getInstance(shiftTime);
    final InstrumentDerivative instrumentTomorrow = definition.toDerivative(horizonDate, yieldCurveNames);
    final MultipleCurrencyAmount paymentToday = instrumentToday.accept(paymentCalculator);
    final SmileDeltaTermStructureDataBundle tomorrowData = FX_OPTION_ROLLDOWN.rollDown(data, shiftTime);
    final PresentValueBlackSmileForexCalculator pvCalculator = PresentValueBlackSmileForexCalculator.getInstance();
    return subtract(instrumentTomorrow.accept(pvCalculator, tomorrowData), instrumentToday.accept(pvCalculator, data)).plus(paymentToday);
  }

  private MultipleCurrencyAmount subtract(final MultipleCurrencyAmount a, final MultipleCurrencyAmount b) {
    return a.plus(b.multipliedBy(-1));
  }
View Full Code Here

      throw new IllegalStateException("Expecting a single payment in the currency of the swap");
    }
    final YieldCurveBundle tomorrowData = CURVE_ROLLDOWN.rollDown(data, shiftTime);
    final Currency currency = paymentToday.getCurrencyAmounts()[0].getCurrency(); //TODO assuming that currencies are all the same
    final PresentValueCalculator pvCalculator = PresentValueCalculator.getInstance();
    final double result = instrumentTomorrow.accept(pvCalculator, tomorrowData) - instrumentToday.accept(pvCalculator, data) + paymentToday.getAmount(currency);
    return MultipleCurrencyAmount.of(CurrencyAmount.of(currency, result));
  }

  public MultipleCurrencyAmount getTheta(final SwaptionPhysicalFixedIborDefinition definition, final ZonedDateTime date, final String[] yieldCurveNames,
      final YieldCurveWithBlackSwaptionBundle data, final int daysForward) {
View Full Code Here

      throw new IllegalStateException("Expecting a single payment in the currency of the interest rate future");
    }
    final YieldCurveBundle tomorrowData = CURVE_ROLLDOWN.rollDown(data, shiftTime);
    final Currency currency = paymentToday.getCurrencyAmounts()[0].getCurrency(); //TODO assuming that currencies are all the same
    final PresentValueCalculator pvCalculator = PresentValueCalculator.getInstance();
    final double result = instrumentTomorrow.accept(pvCalculator, tomorrowData) - instrumentToday.accept(pvCalculator, data) + paymentToday.getAmount(currency);
    return MultipleCurrencyAmount.of(CurrencyAmount.of(currency, result));
  }

  public MultipleCurrencyAmount getTheta(final InterestRateFutureOptionMarginTransactionDefinition definition, final ZonedDateTime date, final String[] yieldCurveNames,
      final YieldCurveWithBlackCubeBundle data, final Double lastMarginPrice, final int daysForward) {
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.