29 termStructure_(
std::move(termStructure)) {
40 ext::shared_ptr<TermStructureConsistentModel> tsmodel =
41 ext::dynamic_pointer_cast<TermStructureConsistentModel>(*
model_);
42 if (tsmodel !=
nullptr) {
43 referenceDate = tsmodel->termStructure()->referenceDate();
44 dayCounter = tsmodel->termStructure()->dayCounter();
54 bool includeRefDatePayments =
57 ext::optional<bool> includeTodaysPayments =
59 if (includeTodaysPayments)
60 includeRefDatePayments = *includeTodaysPayments;
63 for (
Size i=0; i<nPeriods; i++) {
73 includeRefDatePayments ? paymentTime >= 0.0 : paymentTime > 0.0;
78 if (fixingTime <= 0.0) {
82 value += discount *
arguments_.nominals[i] * tenor
84 * std::max(0.0, fixing - strike);
90 value += discount *
arguments_.nominals[i] * tenor
92 * std::max(0.0, strike - fixing);
103 maturity, paymentTime);
111 maturity, paymentTime);
Analytic engine for caps/floors.
void calculate() const override
Handle< YieldTermStructure > termStructure_
AnalyticCapFloorEngine(const ext::shared_ptr< AffineModel > &model, Handle< YieldTermStructure > termStructure=Handle< YieldTermStructure >())
Base class for cap-like instruments.
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.
Base class for some pricing engine on a particular model.
Handle< AffineModel > model_
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
bool & includeReferenceDateEvents()
ext::optional< bool > & includeTodaysCashFlows()
static Settings & instance()
access to the unique instance
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
Maps optional to either the boost or std implementation.