35 const ext::shared_ptr<HullWhite>& model,
43 dampingSteps_(dampingSteps),
45 schemeDesc_(schemeDesc) {
56 const Date referenceDate = ts->referenceDate();
60 auto process = ext::make_shared<OrnsteinUhlenbeckProcess>(
model_->a(),
model_->sigma());
61 auto shortRateMesher = ext::make_shared<FdmSimpleProcess1dMesher>(
xGrid_, process, maturity, 1,
invEps_);
62 auto mesher = ext::make_shared<FdmMesherComposite>(shortRateMesher);
65 const std::vector<Date>& exerciseDates =
arguments_.exercise->dates();
66 std::map<Time, Date> t2d;
68 for (
auto exerciseDate : exerciseDates) {
70 QL_REQUIRE(
t >= 0,
"exercise dates must not contain past date");
72 t2d[
t] = exerciseDate;
77 =
arguments_.swap->iborIndex()->forwardingTermStructure();
79 QL_REQUIRE(fwdTs->dayCounter() == disTs->dayCounter(),
80 "day counter of forward and discount curve must match");
81 QL_REQUIRE(fwdTs->referenceDate() == disTs->referenceDate(),
82 "reference date of forward and discount curve must match");
84 auto fwdModel = ext::make_shared<HullWhite>(fwdTs,
model_->a(),
model_->sigma());
85 auto calculator = ext::make_shared<FdmAffineModelSwapInnerValue<HullWhite>>(
93 mesher, calculator, referenceDate, dc);
100 calculator, maturity,
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.
void calculate() const override
FdHullWhiteSwaptionEngine(const ext::shared_ptr< HullWhite > &model, Size tGrid=100, Size xGrid=100, Size dampingSteps=0, Real invEps=1e-5, const FdmSchemeDesc &schemeDesc=FdmSchemeDesc::Douglas())
const FdmSchemeDesc schemeDesc_
Real valueAt(Real r) const
static ext::shared_ptr< FdmStepConditionComposite > vanillaComposite(const DividendSchedule &schedule, const ext::shared_ptr< Exercise > &exercise, const ext::shared_ptr< FdmMesher > &mesher, const ext::shared_ptr< FdmInnerValueCalculator > &calculator, const Date &refDate, const DayCounter &dayCounter)
Base class for some pricing engine on a particular model.
Handle< HullWhite > model_
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
const ext::shared_ptr< T > & currentLink() const
dereferencing
Single-factor Hull-White (extended Vasicek) model class.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Option exercise classes and payoff function.
finite differences swaption engine
memory layout of a fdm linear operator
FdmMesher which is a composite of Fdm1dMesher.
One-dimensional grid mesher.
composite of fdm step conditions
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
base class for Inter-Bank-Offered-Rate indexes
std::vector< ext::shared_ptr< Dividend > > DividendSchedule
OperatorTraits< FdmLinearOp >::bc_set FdmBoundaryConditionSet
Ornstein-Uhlenbeck process.