public CurrencyAmount visitFXOptionSecurity(final FXOptionSecurity security) {
final Currency currency1 = security.getPutCurrency();
final double amount1 = security.getPutAmount();
final Currency currency2 = security.getCallCurrency();
final double amount2 = security.getCallAmount();
final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
if (currencyPair.getBase().equals(currency1)) {
return CurrencyAmount.of(currency1, amount1);
}
return CurrencyAmount.of(currency2, amount2);
}
@Override
public CurrencyAmount visitFXBarrierOptionSecurity(final FXBarrierOptionSecurity security) {
final Currency currency1 = security.getPutCurrency();
final double amount1 = security.getPutAmount();
final Currency currency2 = security.getCallCurrency();
final double amount2 = security.getCallAmount();
final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
if (currencyPair.getBase().equals(currency1)) {
return CurrencyAmount.of(currency1, amount1);
}
return CurrencyAmount.of(currency2, amount2);
}
@Override
public CurrencyAmount visitNonDeliverableFXOptionSecurity(final NonDeliverableFXOptionSecurity security) {
final Currency currency = security.getDeliveryCurrency();
final double amount = security.getCallCurrency().equals(currency) ? security.getCallAmount() : security.getPutAmount();
return CurrencyAmount.of(currency, amount);
}
@Override
public CurrencyAmount visitFXDigitalOptionSecurity(final FXDigitalOptionSecurity security) {
final Currency currency1 = security.getPutCurrency();
final double amount1 = security.getPutAmount();
final Currency currency2 = security.getCallCurrency();
final double amount2 = security.getCallAmount();
final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
if (currencyPair.getBase().equals(currency1)) {
return CurrencyAmount.of(currency1, amount1);
}
return CurrencyAmount.of(currency2, amount2);
}
@Override
public CurrencyAmount visitNonDeliverableFXDigitalOptionSecurity(final NonDeliverableFXDigitalOptionSecurity security) {
final Currency currency = security.getPaymentCurrency();
final double amount = security.getCallCurrency().equals(currency) ? security.getCallAmount() : security.getPutAmount();
return CurrencyAmount.of(currency, amount);
}
@Override
public CurrencyAmount visitFXForwardSecurity(final FXForwardSecurity security) {
final Currency currency1 = security.getPayCurrency();
final double amount1 = security.getPayAmount();
final Currency currency2 = security.getReceiveCurrency();
final double amount2 = security.getReceiveAmount();
final CurrencyPair currencyPair = currencyPairs.getCurrencyPair(currency1, currency2);
if (currencyPair.getBase().equals(currency1)) {
return CurrencyAmount.of(currency1, amount1);
}
return CurrencyAmount.of(currency2, amount2);
}