31 termStructure_(
std::move(termStructure)) {
39 termStructure_(
std::move(termStructure)) {
47 termStructure_(
std::move(termStructure)) {
54 "cash settled (ParYieldCurve) swaptions not priced with "
55 "TreeSwaptionEngine");
61 ext::shared_ptr<TermStructureConsistentModel> tsmodel =
62 ext::dynamic_pointer_cast<TermStructureConsistentModel>(*
model_);
63 if (tsmodel !=
nullptr) {
64 referenceDate = tsmodel->termStructure()->referenceDate();
65 dayCounter = tsmodel->termStructure()->dayCounter();
72 ext::shared_ptr<Lattice> lattice;
79 lattice =
model_->tree(timeGrid);
82 std::vector<Time> stoppingTimes(
arguments_.exercise->dates().size());
83 for (
Size i=0; i<stoppingTimes.size(); ++i)
88 swaption.
initialize(lattice, stoppingTimes.back());
91 *std::find_if(stoppingTimes.begin(), stoppingTimes.end(),
92 [](
Time t){ return t >= 0.0; });
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 initialize(const ext::shared_ptr< Lattice > &, Time t)
std::vector< Time > mandatoryTimes() const override
Handle< ModelType > model_
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
Engine for a short-rate model specialized on a lattice.
ext::shared_ptr< Lattice > lattice_
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
void calculate() const override
Handle< YieldTermStructure > termStructure_
TreeSwaptionEngine(const ext::shared_ptr< ShortRateModel > &, Size timeSteps, Handle< YieldTermStructure > termStructure=Handle< YieldTermStructure >())
Discretized swaption class.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
Numerical lattice engine for swaptions.