@Override
public boolean canApplyTo(final FunctionCompilationContext context, final ComputationTarget target) {
if (!(target.getPosition().getSecurity() instanceof FinancialSecurity)) {
return false;
}
final FinancialSecurity security = (FinancialSecurity) target.getPosition().getSecurity();
if (!(security instanceof FXDigitalOptionSecurity)) {
return false;
}
final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
return callCurrency.getCode().equals(_callCurrency) && putCurrency.getCode().equals(_putCurrency);
}