Пример #1
0
        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;
        }
Пример #2
0
 //! shorts an instrument from the composite
 public void subtract(Instrument instrument, double multiplier = 1.0)
 {
     add(instrument, -multiplier);
 }
Пример #3
0
 //! adds an instrument to the composite
 public void add(Instrument instrument, double multiplier = 1.0)
 {
     components_.Add(new KeyValuePair <Instrument, double>(instrument, multiplier));
     instrument.registerWith(update);
     update();
 }