public static double calculate(Instrument instrument, IPricingEngine engine, SimpleQuote volQuote, double targetValue, double accuracy, int maxEvaluations, double minVol, double maxVol) { instrument.setupArguments(engine.getArguments()); engine.getArguments().validate(); PriceError f = new PriceError(engine, volQuote, targetValue); Brent solver = new Brent(); solver.setMaxEvaluations(maxEvaluations); double guess = (minVol + maxVol) / 2.0; double result = solver.solve(f, accuracy, guess, minVol, maxVol); return result; }
public static double calculate(Instrument instrument, IPricingEngine engine, SimpleQuote volQuote, double targetValue, double accuracy, int maxEvaluations, double minVol, double maxVol) { instrument.setupArguments(engine.getArguments()); engine.getArguments().validate(); PriceError f = new PriceError(engine, volQuote, targetValue); Brent solver = new Brent(); solver.setMaxEvaluations(maxEvaluations); double guess = (minVol + maxVol) / 2.0; double result = solver.solve(f, accuracy, guess, minVol, maxVol); return(result); }