private static final Function2D<Double, Double> SKEW_CALCULATOR = new LognormalSkewnessFromVolatilityCalculator();
private static final Function2D<Double, Double> KURTOSIS_CALCULATOR = new LognormalPearsonKurtosisFromVolatilityCalculator();
@Override
public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
final EquityOptionSecurity option = (EquityOptionSecurity) target.getSecurity();
final UniqueId uid = option.getUniqueId();
final ZonedDateTime now = ZonedDateTime.now(Clock.systemUTC());
final Expiry expiry = option.getExpiry();
final double t = DateUtils.getDifferenceInYears(now, expiry.getExpiry());
final VolatilitySurface surface = (VolatilitySurface) inputs.getValue(getVolatilitySurfaceRequirement(option));
final double volatility = surface.getVolatility(Pair.of(t, option.getStrike()));
final double skew = SKEW_CALCULATOR.evaluate(volatility, t);
final double pearson = KURTOSIS_CALCULATOR.evaluate(volatility, t);
final double fisher = pearson - 3;
final Set<ComputedValue> results = new HashSet<ComputedValue>();
final ComputationTargetSpecification targetSpec = target.toSpecification();