21#include <ql/exercise.hpp>
22#include <ql/pricingengines/lookback/analyticcontinuouspartialfixedlookback.hpp>
28 ext::shared_ptr<GeneralizedBlackScholesProcess> process)
29 : process_(
std::move(process)) {
35 ext::shared_ptr<PlainVanillaPayoff> payoff =
36 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
arguments_.payoff);
37 QL_REQUIRE(payoff,
"Non-plain payoff given");
39 QL_REQUIRE(
process_->x0() > 0.0,
"negative or null underlying");
41 switch (payoff->optionType()) {
43 QL_REQUIRE(payoff->strike()>=0.0,
44 "Strike must be positive or null");
48 QL_REQUIRE(payoff->strike()>0.0,
49 "Strike must be positive");
53 QL_FAIL(
"Unknown type");
63 ext::shared_ptr<PlainVanillaPayoff> payoff =
64 ext::dynamic_pointer_cast<PlainVanillaPayoff>(
arguments_.payoff);
65 QL_REQUIRE(payoff,
"Non-plain payoff given");
66 return payoff->strike();
110 Real x = 2.0*carry/(vol*vol);
112 Real ls = std::log(s);
117 if (differentStartOfLookback)
130 if (differentStartOfLookback) {
137 Real n4 = cnbn2(eta*e1, eta*d1);
138 Real n5 = cnbn3(-eta*e1, eta*d1);
139 Real n6 = cnbn1(eta*f2, -eta*d2);
143 Real pow_s = std::pow(s, -x);
152 * (1 - 0.5 * vol * vol / carry) *
CumulativeNormalDistribution f_
Time residualTime() const
Volatility volatility() const
AnalyticContinuousPartialFixedLookbackEngine(ext::shared_ptr< GeneralizedBlackScholesProcess > process)
DiscountFactor dividendDiscount() const
Time lookbackPeriodStartTime() const
void calculate() const override
Real stdDeviation() const
Rate riskFreeRate() const
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Rate dividendYield() const
DiscountFactor riskFreeDiscount() const
Cumulative bivariate normal distibution function (West 2004)
ContinuousPartialFixedLookbackOption::results results_
ContinuousPartialFixedLookbackOption::arguments arguments_
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
Real Volatility
volatility