32 ext::shared_ptr<GeneralizedBlackScholesProcess> process1,
33 ext::shared_ptr<GeneralizedBlackScholesProcess> process2,
35 : process1_(
std::move(process1)), process2_(
std::move(process2)), rho_(correlation) {
43 "not an American option");
45 ext::shared_ptr<AmericanExercise> exercise =
46 ext::dynamic_pointer_cast<AmericanExercise>(
arguments_.exercise);
47 QL_REQUIRE(exercise,
"not an American option");
49 ext::shared_ptr<NullPayoff> payoff0 =
50 ext::dynamic_pointer_cast<NullPayoff>(
arguments_.payoff);
67 ext::shared_ptr<StrikedTypePayoff>
payoff(
71 process1_->dividendYield()->discount(exercise->lastDate());
72 Rate q1 = -std::log(dividendDiscount1)/
t;
75 process2_->dividendYield()->discount(exercise->lastDate());
76 Rate q2 = -std::log(dividendDiscount2)/
t;
78 ext::shared_ptr<YieldTermStructure> qTS(
81 ext::shared_ptr<YieldTermStructure> rTS(
85 exercise->lastDate(), s1);
87 exercise->lastDate(), s2);
89 - 2*
rho_*std::sqrt(variance1)*std::sqrt(variance2);
92 ext::shared_ptr<BlackVolTermStructure> volTS(
95 ext::shared_ptr<BlackScholesMertonProcess> stochProcess(
new
101 ext::shared_ptr<PricingEngine> engine(
Bjerksund and Stensland approximation engine.
Black constant volatility, no time dependence, no strike dependence.
ext::shared_ptr< GeneralizedBlackScholesProcess > process2_
ext::shared_ptr< GeneralizedBlackScholesProcess > process1_
void calculate() const override
AnalyticAmericanMargrabeEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process1, ext::shared_ptr< GeneralizedBlackScholesProcess > process2, Real correlation)
Bjerksund and Stensland pricing engine for American options (1993)
Constant Black volatility, no time-strike dependence.
Merton (1973) extension to the Black-Scholes stochastic process.
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.
Flat interest-rate curve.
MargrabeOption::results results_
MargrabeOption::arguments arguments_
Shared handle to an observable.
Real NPV() const
returns the net present value of the instrument.
void setPricingEngine(const ext::shared_ptr< PricingEngine > &)
set the pricing engine to be used.
Calendar for reproducing theoretical calculations.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
DateProxy & evaluationDate()
the date at which pricing is to be performed.
market element returning a stored value
static Settings & instance()
access to the unique instance
Vanilla option (no discrete dividends, no barriers) on a single asset.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
LinearInterpolation variance
flat forward rate term structure
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
Real Volatility
volatility
ext::shared_ptr< QuantLib::Payoff > payoff
Calendar for reproducing theoretical calculations.
Analytic engine for American Margrabe option.