Examples of SmileDeltaTermStructureDataBundle


Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The gamma.
   */
  public CurrencyAmount gammaSpot(final ForexOptionDigital optionForex, final YieldCurveBundle curves, final boolean directQuote) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final Currency domesticCcy;
    if (optionForex.payDomestic()) {
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
    } else {
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The theta
   */
  public CurrencyAmount forwardTheta(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double rDomestic = smile.getCurve(domesticCurveName).getInterestRate(paymentTime);
    final double rForeign = smile.getCurve(foreignCurveName).getInterestRate(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    final double theta = DigitalOptionFunction.theta(spot, strike, expiry, volatility, rDomestic, rDomestic - rForeign, isCall) * longSign
 
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The spot delta
   */
  public double spotDeltaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double rDomestic = smile.getCurve(domesticCurveName).getInterestRate(paymentTime);
    final double rForeign = smile.getCurve(foreignCurveName).getInterestRate(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    return DigitalOptionFunction.delta(spot, strike, expiry, volatility, rDomestic, rDomestic - rForeign, isCall) * longSign;
 
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The forward delta
   */
  public double forwardDeltaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double rDomestic = smile.getCurve(domesticCurveName).getInterestRate(paymentTime);
    final double rForeign = smile.getCurve(foreignCurveName).getInterestRate(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    return DigitalOptionFunction.delta(spot, strike, expiry, volatility, rDomestic, rDomestic - rForeign, isCall) * longSign / dfForeign;
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The spot gamma
   */
  public double spotGammaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double rDomestic = smile.getCurve(domesticCurveName).getInterestRate(paymentTime);
    final double rForeign = smile.getCurve(foreignCurveName).getInterestRate(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    return DigitalOptionFunction.gamma(spot, strike, expiry, volatility, rDomestic, rDomestic - rForeign, isCall) * longSign;
 
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The forward gamma
   */
  public double forwardGammaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double rDomestic = smile.getCurve(domesticCurveName).getInterestRate(paymentTime);
    final double rForeign = smile.getCurve(foreignCurveName).getInterestRate(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    return DigitalOptionFunction.gamma(spot, strike, expiry, volatility, rDomestic, rDomestic - rForeign, isCall) * longSign * dfDomestic / dfForeign / dfForeign;
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The forward vega
   */
  public double forwardVegaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double rDomestic = smile.getCurve(domesticCurveName).getInterestRate(paymentTime);
    final double rForeign = smile.getCurve(foreignCurveName).getInterestRate(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    return DigitalOptionFunction.vega(spot, strike, expiry, volatility, rDomestic, rDomestic - rForeign, isCall) * longSign / dfDomestic;
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The forward driftless theta
   */
  public double forwardDriftlessThetaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    return DigitalOptionFunction.driftlessTheta(forward, strike, expiry, volatility, isCall) * longSign;
 
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

   * @return The forward driftless theta
   */
  public double thetaTheoretical(final ForexOptionDigital optionForex, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(curves, "Curves");
    ArgumentChecker.isTrue(curves instanceof SmileDeltaTermStructureDataBundle, "Yield curve bundle should contain smile data");
    final SmileDeltaTermStructureDataBundle smile = (SmileDeltaTermStructureDataBundle) curves;
    final double paymentTime = optionForex.getUnderlyingForex().getPaymentTime();
    final Currency domesticCcy;
    final Currency foreignCcy;
    final double strike;
    final String foreignCurveName;
    final String domesticCurveName;
    boolean isCall;
    if (optionForex.payDomestic()) {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency2();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency1();
      strike = optionForex.getStrike();
      isCall = optionForex.isCall();
    } else {
      foreignCurveName = optionForex.getUnderlyingForex().getPaymentCurrency2().getFundingCurveName();
      domesticCurveName = optionForex.getUnderlyingForex().getPaymentCurrency1().getFundingCurveName();
      strike = 1.0 / optionForex.getStrike();
      domesticCcy = optionForex.getUnderlyingForex().getCurrency1();
      foreignCcy = optionForex.getUnderlyingForex().getCurrency2();
      isCall = !optionForex.isCall();
    }
    final double dfDomestic = smile.getCurve(domesticCurveName).getDiscountFactor(paymentTime);
    final double dfForeign = smile.getCurve(foreignCurveName).getDiscountFactor(paymentTime);
    final double rDomestic = smile.getCurve(domesticCurveName).getInterestRate(paymentTime);
    final double rForeign = smile.getCurve(foreignCurveName).getInterestRate(paymentTime);
    final double spot = smile.getFxRates().getFxRate(foreignCcy, domesticCcy);
    final double forward = spot * dfForeign / dfDomestic;
    final double expiry = optionForex.getExpirationTime();
    final double volatility = FXVolatilityUtils.getVolatility(smile, foreignCcy, domesticCcy, expiry, forward, forward);
    final double longSign = (optionForex.isLong() ? 1.0 : -1.0);
    return DigitalOptionFunction.theta(spot, strike, expiry, volatility, rDomestic, rDomestic - rForeign, isCall) * longSign;
 
View Full Code Here

Examples of com.opengamma.analytics.financial.model.option.definition.SmileDeltaTermStructureDataBundle

    final ZonedDateTime horizonDate = date.plusDays(daysForward);
    final double shiftTime = TimeCalculator.getTimeBetween(date, horizonDate);
    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);
  }
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.