Package com.opengamma.analytics.financial.model.option.definition

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


    BARRIER_FUNCTION.getPrice(VANILLA_CALL_K100, BARRIER_DOWN_IN, REBATE, 85.0, COST_OF_CARRY, RATE_DOM, VOLATILITY);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void exceptionUp() {
    final Barrier barrierUp = new Barrier(KnockType.IN, BarrierType.UP, ObservationType.CONTINUOUS, 90);
    BARRIER_FUNCTION.getPrice(VANILLA_CALL_K100, barrierUp, REBATE, SPOT, COST_OF_CARRY, RATE_DOM, VOLATILITY);
  }
View Full Code Here


    MODEL.getPricingFunction(null);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullData() {
    MODEL.getPricingFunction(new EuropeanStandardBarrierOptionDefinition(SPOT, EXPIRY, true, new Barrier(KnockType.IN, BarrierType.DOWN, ObservationType.CONTINUOUS, SPOT))).evaluate(
        (StandardOptionDataBundle) null);
  }
View Full Code Here

  @Test
  public void testZeroVol() {
    final double delta = 10;
    final StandardOptionDataBundle data = new StandardOptionDataBundle(YieldCurve.from(ConstantDoublesCurve.from(0.)), 0, new VolatilitySurface(ConstantDoublesSurface.from(0.)), SPOT, DATE);
    Barrier barrier = new Barrier(KnockType.OUT, BarrierType.DOWN, ObservationType.CONTINUOUS, 95);
    EuropeanStandardBarrierOptionDefinition option = new EuropeanStandardBarrierOptionDefinition(SPOT - delta, EXPIRY, true, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 10, 0);
    barrier = new Barrier(KnockType.IN, BarrierType.UP, ObservationType.CONTINUOUS, 105);
    option = new EuropeanStandardBarrierOptionDefinition(SPOT - delta, EXPIRY, true, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), REBATE, 0);
  }
View Full Code Here

  }

  @Test
  public void test() {
    final StandardOptionDataBundle data = new StandardOptionDataBundle(R, B, new VolatilitySurface(ConstantDoublesSurface.from(0.25)), SPOT, DATE);
    Barrier barrier = new Barrier(KnockType.OUT, BarrierType.DOWN, ObservationType.CONTINUOUS, 95);
    EuropeanStandardBarrierOptionDefinition option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, true, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 9.0246, EPS);
    barrier = new Barrier(KnockType.OUT, BarrierType.UP, ObservationType.CONTINUOUS, 105);
    option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, true, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 2.6789, EPS);
    barrier = new Barrier(KnockType.OUT, BarrierType.DOWN, ObservationType.CONTINUOUS, 95);
    option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, false, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 2.2798, EPS);
    barrier = new Barrier(KnockType.OUT, BarrierType.UP, ObservationType.CONTINUOUS, 105);
    option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, false, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 3.7760, EPS);
    barrier = new Barrier(KnockType.IN, BarrierType.DOWN, ObservationType.CONTINUOUS, 95);
    option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, true, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 7.7627, EPS);
    barrier = new Barrier(KnockType.IN, BarrierType.UP, ObservationType.CONTINUOUS, 105);
    option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, true, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 14.1112, EPS);
    barrier = new Barrier(KnockType.IN, BarrierType.DOWN, ObservationType.CONTINUOUS, 95);
    option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, false, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 2.9586, EPS);
    barrier = new Barrier(KnockType.IN, BarrierType.UP, ObservationType.CONTINUOUS, 105);
    option = new EuropeanStandardBarrierOptionDefinition(90, EXPIRY, false, barrier, REBATE);
    assertEquals(MODEL.getPricingFunction(option).evaluate(data), 1.4653, EPS);
  }
View Full Code Here

    final double fxRate = callAmount / putAmount;
    final ZonedDateTime expiry = barrierOptionSecurity.getExpiry().getExpiry();
    final ZonedDateTime settlementDate = barrierOptionSecurity.getSettlementDate();
    final ForexDefinition underlying = new ForexDefinition(putCurrency, callCurrency, settlementDate, putAmount, fxRate); //TODO this needs its own converter
    final boolean isLong = barrierOptionSecurity.isLong();
    final Barrier barrier = new Barrier(getKnockType(barrierOptionSecurity.getBarrierDirection()), getBarrierType(barrierOptionSecurity.getBarrierType()),
        getObservationType(barrierOptionSecurity.getMonitoringType()), level);
    return new ForexOptionSingleBarrierDefinition(new ForexOptionVanillaDefinition(underlying, expiry, true, isLong), barrier);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.option.definition.Barrier

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.