Package com.opengamma.analytics.financial.forex.definition

Examples of com.opengamma.analytics.financial.forex.definition.ForexDefinition


    assertFalse(modifiedOption.equals(option));
    modifiedOption = new ForexOptionDigital(fx, EXPIRATION_TIME - 0.01, IS_CALL, IS_LONG, true);
    assertFalse(modifiedOption.equals(option));
    modifiedOption = new ForexOptionDigital(fx, EXPIRATION_TIME, IS_CALL, !IS_LONG, true);
    assertFalse(modifiedOption.equals(option));
    final ForexDefinition modifiedFxDefinition = new ForexDefinition(CUR_1, CUR_2, PAYMENT_DATE, NOMINAL_1 + 1.0, FX_RATE);
    final Forex modifiedFx = modifiedFxDefinition.toDerivative(REFERENCE_DATE, curveNames);
    modifiedOption = new ForexOptionDigital(modifiedFx, EXPIRATION_TIME, IS_CALL, IS_LONG, true);
    assertFalse(modifiedOption.equals(option));
    assertFalse(modifiedOption.equals(null));
  }
View Full Code Here


    final Forex fx = FX_DEFINITION.toDerivative(REFERENCE_DATE, CURVES_NAME);
    final ForexOptionVanilla optPositiveCall = new ForexOptionVanilla(fx, EXPIRATION_TIME, IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Positive amount / call", optPositiveCall.isCall());
    final ForexOptionVanilla optPositivePut = new ForexOptionVanilla(fx, EXPIRATION_TIME, !IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Positive amount / put", !optPositivePut.isCall());
    final ForexDefinition fxNegativeDefinition = new ForexDefinition(CUR_1, CUR_2, PAYMENT_DATE, -NOMINAL_1, FX_RATE);
    final Forex fxNegative = fxNegativeDefinition.toDerivative(REFERENCE_DATE, CURVES_NAME);
    final ForexOptionVanilla optNegativePut = new ForexOptionVanilla(fxNegative, EXPIRATION_TIME, !IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Negative amount / put", optNegativePut.isCall());
    final ForexOptionVanilla optNegativeCall = new ForexOptionVanilla(fxNegative, EXPIRATION_TIME, IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Negative amount / call", !optNegativeCall.isCall());
  }
View Full Code Here

    assertFalse(modifiedOption.equals(fxOption));
    modifiedOption = new ForexOptionVanilla(fx, EXPIRATION_TIME - 0.01, IS_CALL, IS_LONG);
    assertFalse(modifiedOption.equals(fxOption));
    modifiedOption = new ForexOptionVanilla(fx, EXPIRATION_TIME, IS_CALL, !IS_LONG);
    assertFalse(modifiedOption.equals(fxOption));
    final ForexDefinition modifiedFxDefinition = new ForexDefinition(CUR_1, CUR_2, PAYMENT_DATE, NOMINAL_1 + 1.0, FX_RATE);
    final Forex modifiedFx = modifiedFxDefinition.toDerivative(REFERENCE_DATE, CURVES_NAME);
    modifiedOption = new ForexOptionVanilla(modifiedFx, EXPIRATION_TIME, IS_CALL, IS_LONG);
    assertFalse(modifiedOption.equals(fxOption));
    final EuropeanVanillaOption option = new EuropeanVanillaOption(fxOption.getStrike(), fxOption.getTimeToExpiry(), fxOption.isCall());
    assertFalse(fxOption.equals(option));
    assertFalse(modifiedOption.equals(null));
View Full Code Here

  public void callPut() {
    final ForexOptionVanilla optPositiveCall = new ForexOptionVanilla(FX, EXPIRATION_TIME, IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Positive amount / call", optPositiveCall.isCall());
    final ForexOptionVanilla optPositivePut = new ForexOptionVanilla(FX, EXPIRATION_TIME, !IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Positive amount / put", !optPositivePut.isCall());
    final ForexDefinition fxNegativeDefinition = new ForexDefinition(CUR_1, CUR_2, PAYMENT_DATE, -NOMINAL_1, FX_RATE);
    final Forex fxNegative = fxNegativeDefinition.toDerivative(REFERENCE_DATE);
    final ForexOptionVanilla optNegativePut = new ForexOptionVanilla(fxNegative, EXPIRATION_TIME, !IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Negative amount / put", optNegativePut.isCall());
    final ForexOptionVanilla optNegativeCall = new ForexOptionVanilla(fxNegative, EXPIRATION_TIME, IS_CALL, IS_LONG);
    assertTrue("Forex vanilla option call/put: Negative amount / call", !optNegativeCall.isCall());
  }
View Full Code Here

    final boolean isCall = true;
    final boolean isLong = true;
    final double notional = 100000000;
    final ZonedDateTime payDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, Period.ofMonths(9), BUSINESS_DAY, CALENDAR);
    final ZonedDateTime expDate = ScheduleCalculator.getAdjustedDate(payDate, -SETTLEMENT_DAYS, CALENDAR);
    final ForexDefinition forexUnderlyingDefinition = new ForexDefinition(EUR, USD, payDate, notional, strike);
    final ForexOptionDigitalDefinition forexOptionDefinitionCall = new ForexOptionDigitalDefinition(forexUnderlyingDefinition, expDate, isCall, isLong);
    final ForexOptionDigitalDefinition forexOptionDefinitionPut = new ForexOptionDigitalDefinition(forexUnderlyingDefinition, expDate, !isCall, isLong);
    final ForexOptionDigital forexOptionCall = forexOptionDefinitionCall.toDerivative(REFERENCE_DATE);
    final ForexOptionDigital forexOptionPut = forexOptionDefinitionPut.toDerivative(REFERENCE_DATE);
    final MultipleCurrencyAmount currencyExposureCall = METHOD_BLACK_DIGITAL.currencyExposure(forexOptionCall, SMILE_MULTICURVES);
View Full Code Here

    final boolean isCall = true;
    final boolean isLong = true;
    final double notional = 100000000;
    final ZonedDateTime payDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, Period.ofMonths(9), BUSINESS_DAY, CALENDAR);
    final ZonedDateTime expDate = ScheduleCalculator.getAdjustedDate(payDate, -SETTLEMENT_DAYS, CALENDAR);
    final ForexDefinition forexUnderlyingDefinition = new ForexDefinition(EUR, USD, payDate, notional, strike);
    final ForexOptionDigitalDefinition forexOptionDefinition = new ForexOptionDigitalDefinition(forexUnderlyingDefinition, expDate, isCall, isLong);
    final ForexOptionDigital forexOption = forexOptionDefinition.toDerivative(REFERENCE_DATE);
    final MultipleCurrencyAmount ceMethod = METHOD_BLACK_DIGITAL.currencyExposure(forexOption, SMILE_MULTICURVES);
    final MultipleCurrencyAmount ceCalculator = forexOption.accept(CEFBC, SMILE_MULTICURVES);
    assertEquals("Forex Digital option: currency exposure Method vs Calculator", ceMethod.getAmount(EUR), ceCalculator.getAmount(EUR), 1E-2);
View Full Code Here

    final boolean isCall = true;
    final boolean isLong = true;
    final double notional = 100000000;
    final ZonedDateTime payDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, Period.ofMonths(9), BUSINESS_DAY, CALENDAR);
    final ZonedDateTime expDate = ScheduleCalculator.getAdjustedDate(payDate, -SETTLEMENT_DAYS, CALENDAR);
    final ForexDefinition forexUnderlyingDefinition = new ForexDefinition(EUR, USD, payDate, notional, strike);
    final ForexOptionDigitalDefinition forexOptionDefinitionCall = new ForexOptionDigitalDefinition(forexUnderlyingDefinition, expDate, isCall, isLong);
    final ForexOptionDigital forexOptionCall = forexOptionDefinitionCall.toDerivative(REFERENCE_DATE);
    final MultipleCurrencyParameterSensitivity pvpsExact = PS_FBS_C.calculateSensitivity(forexOptionCall, SMILE_FLAT_MULTICURVES, SMILE_FLAT_MULTICURVES
        .getMulticurveProvider().getAllNames());
    final MultipleCurrencyParameterSensitivity pvpsFD = PS_FBS_FDC.calculateSensitivity(forexOptionCall, SMILE_FLAT_MULTICURVES);
View Full Code Here

   * Test the price scaling and the long/short parity.
   */
  public void scaleLongShortParity() {
    final MultipleCurrencyAmount priceBarrier = METHOD_BARRIER.presentValue(OPTION_BARRIER, SMILE_BUNDLE);
    final double scale = 10;
    final ForexDefinition fxDefinitionScale = new ForexDefinition(EUR, USD, OPTION_PAY_DATE, NOTIONAL * scale, STRIKE);
    final ForexOptionVanillaDefinition optionDefinitionScale = new ForexOptionVanillaDefinition(fxDefinitionScale, OPTION_EXPIRY_DATE, IS_CALL, IS_LONG);
    final ForexOptionVanilla optionScale = optionDefinitionScale.toDerivative(REFERENCE_DATE, CURVES_NAME);
    final ForexOptionSingleBarrier optionBarrierScale = new ForexOptionSingleBarrier(optionScale, BARRIER_KI, scale * REBATE);
    final MultipleCurrencyAmount priceBarrierScale = METHOD_BARRIER.presentValue(optionBarrierScale, SMILE_BUNDLE);
    assertEquals("Barriers are cheaper than vanilla", priceBarrier.getAmount(USD) * scale, priceBarrierScale.getAmount(USD), 1.0E-2);
View Full Code Here

    assertFalse(modifiedOption.equals(FX_OPTION));
    modifiedOption = new ForexOptionVanilla(FX, EXPIRATION_TIME - 0.01, IS_CALL, IS_LONG);
    assertFalse(modifiedOption.equals(FX_OPTION));
    modifiedOption = new ForexOptionVanilla(FX, EXPIRATION_TIME, IS_CALL, !IS_LONG);
    assertFalse(modifiedOption.equals(FX_OPTION));
    final ForexDefinition modifiedFxDefinition = new ForexDefinition(CUR_1, CUR_2, PAYMENT_DATE, NOMINAL_1 + 1.0, FX_RATE);
    final Forex modifiedFx = modifiedFxDefinition.toDerivative(REFERENCE_DATE);
    modifiedOption = new ForexOptionVanilla(modifiedFx, EXPIRATION_TIME, IS_CALL, IS_LONG);
    assertFalse(modifiedOption.equals(FX_OPTION));
    final EuropeanVanillaOption option = new EuropeanVanillaOption(FX_OPTION.getStrike(), FX_OPTION.getTimeToExpiry(), FX_OPTION.isCall());
    assertFalse(FX_OPTION.equals(option));
    assertFalse(modifiedOption.equals(null));
View Full Code Here

    // ForexVanillaOption's are defined in terms of the underlying forward FX transaction, the exchange of two fixed amounts in different currencies.
    // The relative size of the payments implicitly defines the option's strike. So we will build a number of ForexDefinition's below
    final PaymentFixedDefinition quoteCcyPayment = new PaymentFixedDefinition(quoteCcy, settlement, -1 * quoteAmt);
    final PaymentFixedDefinition baseCcyPayment = new PaymentFixedDefinition(baseCcy, settlement, baseAmt);
    final ForexDefinition fxFwd = new ForexDefinition(baseCcyPayment, quoteCcyPayment); // This is what defines the strike, K = quoteAmt / baseAmt
    // We restrike an option by changing the underlying Forex, adjusting the Payments to match the formulae: k = A2/A1, N = A1.
    final ForexDefinition fxFwdForBarrier = new ForexDefinition(baseCcyPayment, new PaymentFixedDefinition(quoteCcy, settlement, -1 * barrier * baseAmt));

    // For the binaries, we do this by adjusting A1' = size * A1; A2' = A1' * newStrike as A1 is the Notional in this interpretation
    final double baseAmtForSpread = size * baseAmt;
    final PaymentFixedDefinition baseCcyPmtForSpread = new PaymentFixedDefinition(baseCcy, settlement, baseAmtForSpread);
    final ForexDefinition fxFwdForNearStrike = new ForexDefinition(baseCcyPmtForSpread, new PaymentFixedDefinition(quoteCcy, settlement, -1 * nearStrike * baseAmtForSpread));
    final ForexDefinition fxFwdForFarStrike = new ForexDefinition(baseCcyPmtForSpread, new PaymentFixedDefinition(quoteCcy, settlement, -1 * farStrike * baseAmtForSpread));


    // Switch  on type
    switch (bInOut) {
      case KNOCK_OUT: // Long a linear at strike, short a linear at barrier, short a binary at barrier of size (barrier-strike)
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.forex.definition.ForexDefinition

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.