Package org.jquantlib.instruments

Examples of org.jquantlib.instruments.DiscreteAveragingAsianOption.NPV()


                                        // perturb date and get theta
                                        final Date yesterday = today.sub(1);
                                        final Date tomorrow = today.add(1);
                                        final double dT = dc.yearFraction(yesterday, tomorrow);
                                        new Settings().setEvaluationDate(yesterday);
                                        value_m = option.NPV();
                                        new Settings().setEvaluationDate(tomorrow);
                                        value_p = option.NPV();
                                        expected.put("theta", (value_p - value_m) / dT);
                                        new Settings().setEvaluationDate(today);
                                        // compare
View Full Code Here


                                        final Date tomorrow = today.add(1);
                                        final double dT = dc.yearFraction(yesterday, tomorrow);
                                        new Settings().setEvaluationDate(yesterday);
                                        value_m = option.NPV();
                                        new Settings().setEvaluationDate(tomorrow);
                                        value_p = option.NPV();
                                        expected.put("theta", (value_p - value_m) / dT);
                                        new Settings().setEvaluationDate(today);
                                        // compare
                                        for (final Entry<String, Double> greek : calculated.entrySet()) {
                                            final double expct = expected.get(greek.getKey());
View Full Code Here

        final PricingEngine engine2 = new AnalyticDiscreteGeometricAveragePriceAsianEngine(stochProcess);
        final DiscreteAveragingAsianOption option2 = new DiscreteAveragingAsianOption(
                averageType, runningAccumulator, pastFixings, fixingDates, payoff, exercise);
        option2.setPricingEngine(engine2);

        calculated = option2.NPV();
        tolerance = 3.0e-3;
        if (Math.abs(calculated - expected) > tolerance) {
            reportFailure("value", averageType, runningAccumulator, pastFixings, fixingDates, payoff, exercise, spot.value(),
                    qRate.value(), rRate.value(), today, vol.value(), expected, calculated, tolerance);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.