29 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
30 : process_(
std::move(process)) {
40 "Risk-free rate and dividend yield must"
41 "have the same day counter");
43 "Risk-free rate and volatility must"
44 "have the same day counter");
56 process_->dividendYield()->zeroRate(maturity, divdc,
59 process_->riskFreeRate()->zeroRate(maturity, rfdc,
62 QL_REQUIRE(spot > 0.0,
"negative or null spot value");
63 QL_REQUIRE(strike > 0.0,
"negative or null strike value");
65 "negative or null volatility");
67 "choosing date earlier than or equal to evaluation date");
69 Real d = (std::log(spot/strike)
70 + ((riskFreeRate-dividendRate) + volatility*volatility*0.5)*timeToMaturity)
71 /(volatility*std::sqrt(timeToMaturity));
73 Real y = (std::log(spot/strike) + (riskFreeRate-dividendRate)*timeToMaturity
74 + (volatility*volatility*timeToChoosing/2))
75 /(volatility*std::sqrt(timeToChoosing));
80 - strike*std::exp(-riskFreeRate*timeToMaturity)
81 *
f(
d-volatility*std::sqrt(timeToMaturity))
82 -spot*std::exp(-dividendRate*timeToMaturity)*
f(-
y)
83 +strike*std::exp(-riskFreeRate*timeToMaturity)
84 *
f(-
y+volatility*std::sqrt(timeToChoosing));
void calculate() const override
AnalyticSimpleChooserEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process)
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Cumulative normal distribution function.
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
SimpleChooserOption::results results_
SimpleChooserOption::arguments arguments_
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
ext::shared_ptr< Exercise > exercise
ext::shared_ptr< Payoff > payoff
DateProxy & evaluationDate()
the date at which pricing is to be performed.
static Settings & instance()
access to the unique instance
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
@ NoFrequency
null frequency
Real Volatility
volatility
ext::shared_ptr< QuantLib::Payoff > payoff
normal, cumulative and inverse cumulative distributions
Payoffs for various options.
Analytic engine for simple chooser option.