コード例 #1
0
 protected FXOptionSecurity createFXOptionSecurity(final Bundle bundle) {
   final Currency putCurrency = bundle._firstCurrency;
   final Currency callCurrency = bundle._secondCurrency;
   final double putAmount = bundle._firstCurrency.equals(Currency.JPY) ? NOTIONAL * 100 : NOTIONAL;
   final ZonedDateTime settlementDate = bundle._tradeDate.plusDays(bundle._daysOffset);
   final Double fxRate =
       getApproxFXRate(
           settlementDate.toLocalDate(), Pair.of(bundle._firstCurrency, bundle._secondCurrency));
   if (fxRate == null) {
     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;
 }