/src/quantlib/ql/pricingengines/blackscholescalculator.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2006 Ferdinando Ametrano |
5 | | |
6 | | This file is part of QuantLib, a free-software/open-source library |
7 | | for financial quantitative analysts and developers - http://quantlib.org/ |
8 | | |
9 | | QuantLib is free software: you can redistribute it and/or modify it |
10 | | under the terms of the QuantLib license. You should have received a |
11 | | copy of the license along with this program; if not, please email |
12 | | <quantlib-dev@lists.sf.net>. The license is also available online at |
13 | | <http://quantlib.org/license.shtml>. |
14 | | |
15 | | This program is distributed in the hope that it will be useful, but WITHOUT |
16 | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
17 | | FOR A PARTICULAR PURPOSE. See the license for more details. |
18 | | */ |
19 | | |
20 | | #include <ql/pricingengines/blackscholescalculator.hpp> |
21 | | |
22 | | namespace QuantLib { |
23 | | |
24 | | BlackScholesCalculator::BlackScholesCalculator( |
25 | | const ext::shared_ptr<StrikedTypePayoff>& payoff, |
26 | | Real spot, |
27 | | DiscountFactor growth, |
28 | | Real stdDev, |
29 | | DiscountFactor discount) |
30 | 0 | : BlackCalculator(payoff, spot*growth/discount, stdDev, discount), |
31 | 0 | spot_(spot), growth_(growth) |
32 | 0 | { |
33 | 0 | QL_REQUIRE(spot_>0.0, |
34 | 0 | "spot (" << spot_ << ") must be positive"); |
35 | 0 | QL_REQUIRE(growth_>0.0, |
36 | 0 | "growth (" << growth_ << ") must be positive"); |
37 | 0 | } |
38 | | |
39 | | BlackScholesCalculator::BlackScholesCalculator(Option::Type type, |
40 | | Real strike, |
41 | | Real spot, |
42 | | DiscountFactor growth, |
43 | | Real stdDev, |
44 | | DiscountFactor discount) |
45 | 0 | : BlackCalculator(type, strike, spot*growth/discount, stdDev, discount), |
46 | 0 | spot_(spot), growth_(growth) |
47 | 0 | { |
48 | 0 | QL_REQUIRE(spot_>0.0, |
49 | 0 | "spot (" << spot_ << ") must be positive"); |
50 | 0 | QL_REQUIRE(growth_>0.0, |
51 | 0 | "growth (" << growth_ << ") must be positive"); |
52 | 0 | } |
53 | | |
54 | | } |