21#include <ql/cashflows/floatingratecoupon.hpp>
26 const std::vector<Currency>& currency,
const QuantLib::ext::shared_ptr<Exercise>& exercise,
27 const Settlement::Type settlementType, Settlement::Method settlementMethod)
28 : legs_(legs), payer_(payer), currency_(currency), exercise_(exercise), settlementType_(settlementType),
29 settlementMethod_(settlementMethod) {
31 QL_REQUIRE(
legs_.size() > 0,
"MultiLegOption: No legs are given");
33 "MultiLegOption: payer size (" <<
payer.size() <<
") does not match legs size (" <<
legs_.size() <<
")");
35 <<
") does not match legs size ("
36 <<
legs_.size() <<
")");
40 for (
auto const& l :
legs_) {
47 for (
auto const& l :
legs_) {
48 for (
auto const& c : l) {
50 if (
auto lazy = QuantLib::ext::dynamic_pointer_cast<LazyObject>(c))
51 lazy->alwaysForwardNotifications();
58 for (
auto& l :
legs_) {
60 if (
auto lazy = QuantLib::ext::dynamic_pointer_cast<LazyObject>(c))
68 Date today = Settings::instance().evaluationDate();
73 return today >=
exercise_->dates().back();
79 QL_REQUIRE(
underlyingNpv_ != Null<Real>(),
"MultiLegOption: underlying npv not available");
85 QL_REQUIRE(tmp !=
nullptr,
"MultiLegOption: wrong pricing engine argument type");
95 Instrument::fetchResults(r);
105 Instrument::results::reset();
std::vector< bool > payer
QuantLib::ext::shared_ptr< Exercise > exercise
std::vector< Currency > currency
Settlement::Method settlementMethod
Settlement::Type settlementType
const Settlement::Method settlementMethod_
void setupArguments(PricingEngine::arguments *) const override
MultiLegOption(const std::vector< Leg > &legs, const std::vector< bool > &payer, const std::vector< Currency > ¤cy, const QuantLib::ext::shared_ptr< Exercise > &exercise=QuantLib::ext::shared_ptr< Exercise >(), const Settlement::Type settlementType=Settlement::Physical, Settlement::Method settlementMethod=Settlement::PhysicalOTC)
exercise = nullptr means that the instrument is identical to the underlying itself (i....
bool isExpired() const override
const QuantLib::ext::shared_ptr< Exercise > exercise_
void deepUpdate() override
const Date & maturityDate() const
const Settlement::Type settlementType_
const std::vector< bool > payer_
const std::vector< Leg > legs_
void fetchResults(const PricingEngine::results *) const override
Real underlyingNpv() const
const std::vector< Currency > currency_
const std::vector< bool > & payer() const
multi leg option instrument