final double optionPrice;
final double strike;
final double timeToExpiry;
final boolean isCall;
if (derivative instanceof EquityOption) {
final EquityOption option = (EquityOption) derivative;
strike = option.getStrike();
timeToExpiry = option.getTimeToExpiry();
isCall = option.isCall();
if (marketPrice == null) {
optionPrice = derivative.accept(s_pvCalculator, market) / option.getUnitAmount();
} else {
optionPrice = marketPrice;
}
} else if (derivative instanceof EquityIndexOption) {
final EquityIndexOption option = (EquityIndexOption) derivative;
strike = option.getStrike();
timeToExpiry = option.getTimeToExpiry();
isCall = option.isCall();
if (marketPrice == null) {
optionPrice = derivative.accept(s_pvCalculator, market) / option.getUnitAmount();
} else {
optionPrice = marketPrice;
}
} else if (derivative instanceof EquityIndexFutureOption) {
final EquityIndexFutureOption option = (EquityIndexFutureOption) derivative;
strike = option.getStrike();
timeToExpiry = option.getExpiry();
isCall = option.isCall();
if (marketPrice == null) {
optionPrice = derivative.accept(s_pvCalculator, market) / option.getPointValue();
} else {
optionPrice = marketPrice;
}
} else {