コード例 #1
0
ファイル: ImpliedVolatility.cs プロジェクト: ammachado/QLNet
        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();
 }