Package com.opengamma.financial.security.option

Examples of com.opengamma.financial.security.option.FXOptionSecurity


      return null;
    }
    final double callAmount = NOTIONAL * fxRate;
    final Expiry expiry = new Expiry(settlementDate, ExpiryAccuracy.DAY_MONTH_YEAR);
    final String dateString = settlementDate.toString(DATE_FORMATTER);
    final FXOptionSecurity fxOptionSecurity = new FXOptionSecurity(putCurrency, callCurrency, putAmount, callAmount, expiry, settlementDate, bundle._long, new EuropeanExerciseType());
    final String callAmountString = NOTIONAL_FORMATTER.format(callAmount);
    final String putAmountString = NOTIONAL_FORMATTER.format(putAmount);
    fxOptionSecurity.setName((bundle._long ? "Long " : "Short ") + "put " + putCurrency + " " + putAmountString + ", call " + callCurrency + " " + callAmountString + " on " + dateString);
    return fxOptionSecurity;
  }
View Full Code Here


    trade.setPremiumCurrency(security.getPayCurrency());
    return trade;
  }

  protected ManageableTrade createFXOptionSecurityTrade(final Bundle bundle, final BigDecimal quantity, final SecurityPersister persister, final NameGenerator counterPartyGenerator) {
    final FXOptionSecurity security = createFXOptionSecurity(bundle);
    if (security == null) {
      return null;
    }
    ManageableTrade trade = new ManageableTrade(quantity, persister.storeSecurity(security), bundle._tradeDate.toLocalDate(), bundle._tradeDate.toOffsetDateTime().toOffsetTime(),
        ExternalId.of(Counterparty.DEFAULT_SCHEME, counterPartyGenerator.createName()));
    trade.setPremium(security.getCallAmount());
    trade.setPremiumCurrency(security.getCallCurrency());
    return trade;
  }
View Full Code Here

    assertEquals(ExternalId.of(SCHEME, "FXFUTURE_OPTION"), ids.get(0));
  }

  @Test
  public void testFXOptionSecurity() {
    final FXOptionSecurity security = ExposureFunctionTestHelper.getFXOptionSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "FX_OPTION"), ids.get(0));
  }
View Full Code Here

    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "FXFUTURE_OPTION_USD"), ExternalId.of(SCHEME, "FXFUTURE_OPTION_EUR"))));
  }

  @Test
  public void testFXOptionSecurity() {
    final FXOptionSecurity security = ExposureFunctionTestHelper.getFXOptionSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(2, ids.size());
    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "FX_OPTION_USD"), ExternalId.of(SCHEME, "FX_OPTION_EUR"))));
  }
View Full Code Here

    assertNull(ids);
  }

  @Test
  public void testFXOptionSecurity() {
    final FXOptionSecurity security = ExposureFunctionTestHelper.getFXOptionSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertNull(ids);
  }
View Full Code Here

    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "USD"), ExternalId.of(SCHEME, "EUR"))));
  }

  @Test
  public void testFXOptionSecurity() {
    final FXOptionSecurity security = ExposureFunctionTestHelper.getFXOptionSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(2, ids.size());
    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "USD"), ExternalId.of(SCHEME, "EUR"))));
  }
View Full Code Here

    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "987"));
    return security;
  }

  public static FXOptionSecurity getFXOptionSecurity() {
    final FXOptionSecurity security = new FXOptionSecurity(EUR, USD, 1200, 1000, new Expiry(DateUtils.getUTCDate(2015, 1, 1)), DateUtils.getUTCDate(2015, 1, 3), false, new AmericanExerciseType());
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "54"));
    return security;
  }
View Full Code Here

  public ManageableSecurity[] extractSecurities() {
    FxOptionTrade trade = getTrade();
    FxOptionCalculator calculator = new FxOptionCalculator(trade, trade.getNotional(), trade.getNotionalCurrency());
    ExerciseType exerciseType = trade.getExerciseType().convert();
    ManageableSecurity security = trade.getSettlementType() == SettlementType.PHYSICAL ?
        new FXOptionSecurity(
            calculator.getPutCurrency(),
            calculator.getCallCurrency(),
            calculator.getPutAmount(),
            calculator.getCallAmount(),
            calculator.getExpiry(),
View Full Code Here

    final double callAmount = 0;
    final Expiry expiry = expiry();
    final ZonedDateTime settlementDate = expiry.getExpiry();
    final boolean isLong = bool();
    final ExerciseType exerciseType = exerciseType();
    final FXOptionSecurity security = new FXOptionSecurity(putCurrency, callCurrency, putAmount, callAmount, expiry, settlementDate, isLong, exerciseType);
    store(security);
    return security;
  }
View Full Code Here

    assertNull(ids);
  }

  @Test
  public void testFXOptionSecurity() {
    final FXOptionSecurity security = ExposureFunctionTestHelper.getFXOptionSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertNull(ids);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.security.option.FXOptionSecurity

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.