Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
CommodityFloatingLegBuilder Class Reference

#include <ored/portfolio/commoditylegbuilder.hpp>

+ Inheritance diagram for CommodityFloatingLegBuilder:
+ Collaboration diagram for CommodityFloatingLegBuilder:

Public Member Functions

 CommodityFloatingLegBuilder ()
 
QuantLib::Leg buildLeg (const ore::data::LegData &data, const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &engineFactory, RequiredFixings &requiredFixings, const std::string &configuration, const QuantLib::Date &openEndDateReplacement=Null< Date >(), const bool useXbsCurves=false) const override
 
bool allAveraging () const
 Inspect the allAveraging_ flag. More...
 
- Public Member Functions inherited from LegBuilder
 LegBuilder (const string &legType)
 
virtual ~LegBuilder ()
 
virtual Leg buildLeg (const LegData &data, const QuantLib::ext::shared_ptr< EngineFactory > &, RequiredFixings &requiredFixings, const string &configuration, const QuantLib::Date &openEndDateReplacement=Null< Date >(), const bool useXbsCurves=false) const =0
 
const string & legType () const
 

Private Attributes

bool allAveraging_
 

Detailed Description

Definition at line 44 of file commoditylegbuilder.hpp.

Constructor & Destructor Documentation

◆ CommodityFloatingLegBuilder()

Definition at line 46 of file commoditylegbuilder.hpp.

47 : LegBuilder("CommodityFloating"), allAveraging_(false) {}
LegBuilder(const string &legType)

Member Function Documentation

◆ buildLeg()

Leg buildLeg ( const ore::data::LegData data,
const QuantLib::ext::shared_ptr< ore::data::EngineFactory > &  engineFactory,
RequiredFixings requiredFixings,
const std::string &  configuration,
const QuantLib::Date &  openEndDateReplacement = Null<Date>(),
const bool  useXbsCurves = false 
) const
override

Definition at line 411 of file commoditylegbuilder.cpp.

413 {
414
415 // allAveraging_ flag should be reset to false before each build. If we do not do this, the allAveraging_
416 // flag may have been set from building a different leg previously
417 allAveraging_ = false;
418
419 auto floatingLegData = QuantLib::ext::dynamic_pointer_cast<CommodityFloatingLegData>(data.concreteLegData());
420 QL_REQUIRE(floatingLegData, "Wrong LegType: expected CommodityFloating but got " << data.legType());
421
422 // Commodity name and its conventions.
423 // Default weekends only calendar used to create the "index". Attempt to populate with sth sensible here.
424 string commName = floatingLegData->name();
425 Calendar commCal = WeekendsOnly();
426 QuantLib::ext::shared_ptr<Conventions> conventions = InstrumentConventions::instance().conventions();
427 QuantLib::ext::shared_ptr<CommodityFutureConvention> commFutureConv;
428 boost::optional<pair<Calendar, Real>> offPeakPowerData;
429 bool balanceOfTheMonth = false;
430 if (conventions->has(commName)) {
431 QuantLib::ext::shared_ptr<Convention> commConv = conventions->get(commName);
432
433 // If commodity forward convention
434 if (auto c = QuantLib::ext::dynamic_pointer_cast<CommodityForwardConvention>(commConv)) {
435 if (c->advanceCalendar() != NullCalendar()) {
436 commCal = c->advanceCalendar();
437 }
438 }
439
440 // If commodity future convention
441 commFutureConv = QuantLib::ext::dynamic_pointer_cast<CommodityFutureConvention>(commConv);
442 if (commFutureConv) {
443 balanceOfTheMonth = commFutureConv->balanceOfTheMonth();
444 commCal = commFutureConv->calendar();
445 if (const auto& oppid = commFutureConv->offPeakPowerIndexData()) {
446 offPeakPowerData = make_pair(oppid->peakCalendar(), oppid->offPeakHours());
447 }
448 }
449 }
450
451 // Get price type i.e. is the commodity floating leg referencing the spot price or a future settlement price.
452 CommodityPriceType priceType = floatingLegData->priceType();
453
454 // If referencing a future settlement price, we will need a valid FutureExpiryCalculator below.
455 QuantLib::ext::shared_ptr<FutureExpiryCalculator> feCalc;
456 if (priceType == CommodityPriceType::FutureSettlement) {
457
458 // We should have a valid commodity future convention in this case but check anyway
459 QL_REQUIRE(commFutureConv, "Expected to have a commodity future convention for commodity " << commName);
460
461 feCalc = QuantLib::ext::make_shared<ConventionsBasedFutureExpiry>(*commFutureConv);
462
463 // If the future contract is averaging but the trade is not averaging, we can't price the trade
464 // TODO: Should we just issue a warning here, switch the trade to averaging and price it?
465 if (commFutureConv->isAveraging()) {
466 QL_REQUIRE(floatingLegData->isAveraged(),
467 "The future, " << commName << ", is averaging but the leg is not.");
468 allAveraging_ = true;
469 }
470 }
471
472 // Construct the commodity index.
473 Handle<PriceTermStructure> priceCurve = engineFactory->market()->commodityPriceCurve(commName, configuration);
474 auto index = parseCommodityIndex(commName, false, priceCurve, NullCalendar(),
476
477 // Get the commodity floating leg schedule and quantities
478 Schedule schedule = makeSchedule(data.schedule());
479 vector<Real> quantities =
480 buildScheduledVector(floatingLegData->quantities(), floatingLegData->quantityDates(), schedule);
481
482 // Get spreads and gearings which may be empty
483 vector<Real> spreads = buildScheduledVector(floatingLegData->spreads(), floatingLegData->spreadDates(), schedule);
484 vector<Real> gearings =
485 buildScheduledVector(floatingLegData->gearings(), floatingLegData->gearingDates(), schedule);
486
487 // Get explicit pricing dates which in most cases should be empty
488 vector<Date> pricingDates;
489 if (!floatingLegData->pricingDates().empty()) {
490 pricingDates = parseVectorOfValues<Date>(floatingLegData->pricingDates(), &parseDate);
491 }
492
493 // Some common variables needed in building the commodity floating leg
494 PaymentLag paymentLag = parsePaymentLag(data.paymentLag());
495 BusinessDayConvention paymentConvention =
496 data.paymentConvention().empty() ? Following : parseBusinessDayConvention(data.paymentConvention());
497 Calendar paymentCalendar =
498 data.paymentCalendar().empty() ? schedule.calendar() : parseCalendar(data.paymentCalendar());
499 Calendar pricingCalendar;
500
501 // Override missing pricing calendar with calendar from convention
502 if (floatingLegData->pricingCalendar().empty() && floatingLegData->isAveraged() && balanceOfTheMonth &&
503 commFutureConv) {
504 pricingCalendar = commFutureConv->balanceOfTheMonthPricingCalendar();
505 } else if (floatingLegData->pricingCalendar().empty()) {
506 pricingCalendar = commCal;
507 } else {
508 pricingCalendar = parseCalendar(floatingLegData->pricingCalendar());
509 }
510
511 // Get explicit payment dates which in most cases should be empty
512 vector<Date> paymentDates;
513
514
515 Schedule paymentSchedule = makeSchedule(data.paymentSchedule(), openEndDateReplacement);
516
517 if (!paymentSchedule.empty()) {
518 paymentDates = paymentSchedule.dates();
519 } else if (!data.paymentDates().empty()) {
520 BusinessDayConvention paymentDatesConvention =
521 data.paymentConvention().empty() ? Unadjusted : parseBusinessDayConvention(data.paymentConvention());
522 Calendar paymentDatesCalendar =
523 data.paymentCalendar().empty() ? NullCalendar() : parseCalendar(data.paymentCalendar());
524 paymentDates = parseVectorOfValues<Date>(data.paymentDates(), &parseDate);
525 for (Size i = 0; i < paymentDates.size(); i++)
526 paymentDates[i] = paymentDatesCalendar.adjust(paymentDates[i], paymentDatesConvention);
527 }
528
529 // May need to poulate hours per day
530 auto hoursPerDay = floatingLegData->hoursPerDay();
531 if ((floatingLegData->commodityQuantityFrequency() == CommodityQuantityFrequency::PerHour ||
532 floatingLegData->commodityQuantityFrequency() == CommodityQuantityFrequency::PerHourAndCalendarDay) &&
533 hoursPerDay == Null<Natural>()) {
534 QL_REQUIRE(commFutureConv,
535 "Commodity floating leg commodity frequency set to PerHour / PerHourAndCalendarDay but"
536 << " no HoursPerDay provided in floating leg data and no commodity future convention for "
537 << commName);
538 hoursPerDay = commFutureConv->hoursPerDay();
539 QL_REQUIRE(commFutureConv,
540 "Commodity floating leg commodity frequency set to PerHour / PerHourAndCalendarDay but"
541 << " no HoursPerDay provided in floating leg data and commodity future convention for "
542 << commName << " does not provide it.");
543 }
544
545 // populate daylight saving begin / end
546 std::string daylightSavingLocation;
547 if (floatingLegData->commodityQuantityFrequency() == CommodityQuantityFrequency::PerHourAndCalendarDay) {
548 QL_REQUIRE(
549 commFutureConv,
550 "Commodity floating leg commodity frequency set to PerHourAndCalendarDay, need commodity convention for "
551 << commName);
552 daylightSavingLocation = commFutureConv->savingsTime();
553 }
554 QuantLib::ext::shared_ptr<FxIndex> fxIndex;
555 // Build the leg. Different ctor depending on whether cashflow is averaging or not.
556 Leg leg;
557
558 bool isCashFlowAveraged =
559 floatingLegData->isAveraged() && !allAveraging_ && floatingLegData->lastNDays() == Null<Natural>();
560
561 // If daily expiry offset is given, check that referenced future contract has a daily frequency.
562 auto dailyExpOffset = floatingLegData->dailyExpiryOffset();
563 if (dailyExpOffset != Null<Natural>() && dailyExpOffset > 0) {
564 QL_REQUIRE(commFutureConv, "A positive DailyExpiryOffset has been provided but no commodity"
565 << " future convention given for " << commName);
566 QL_REQUIRE(commFutureConv->contractFrequency() == Daily,
567 "A positive DailyExpiryOffset has been"
568 << " provided but the commodity contract frequency is not Daily ("
569 << commFutureConv->contractFrequency() << ")");
570 }
571
572 if (!floatingLegData->fxIndex().empty()) { // build the fxIndex for daily average conversion
573 auto underlyingCcy = priceCurve->currency().code();
574 auto npvCurrency = data.currency();
575 if (underlyingCcy != npvCurrency) // only need an FX Index if currencies differ
576 fxIndex = buildFxIndex(floatingLegData->fxIndex(), npvCurrency, underlyingCcy, engineFactory->market(),
577 engineFactory->configuration(MarketContext::pricing));
578 }
579
580 if (isCashFlowAveraged) {
582 CommodityIndexedAverageCashFlow::PaymentTiming::InArrears;
583 if (floatingLegData->commodityPayRelativeTo() == CommodityPayRelativeTo::CalculationPeriodStartDate) {
584 paymentTiming = CommodityIndexedAverageCashFlow::PaymentTiming::InAdvance;
585 } else if (floatingLegData->commodityPayRelativeTo() == CommodityPayRelativeTo::CalculationPeriodEndDate) {
586 paymentTiming = CommodityIndexedAverageCashFlow::PaymentTiming::InArrears;
587 } else if (floatingLegData->commodityPayRelativeTo() == CommodityPayRelativeTo::FutureExpiryDate) {
588 QL_FAIL("CommodityLegBuilder: CommodityPayRelativeTo 'FutureExpiryDate' not allowed for average cashflow.");
589 } else {
590 QL_FAIL("CommodityLegBuilder: CommodityPayRelativeTo " << floatingLegData->commodityPayRelativeTo()
591 << " not handled. This is an internal error.");
592 }
593
594 leg = CommodityIndexedAverageLeg(schedule, index)
595 .withQuantities(quantities)
596 .withPaymentLag(boost::apply_visitor(PaymentLagInteger(), paymentLag))
597 .withPaymentCalendar(paymentCalendar)
598 .withPaymentConvention(paymentConvention)
599 .withPricingCalendar(pricingCalendar)
600 .withSpreads(spreads)
601 .withGearings(gearings)
602 .paymentTiming(paymentTiming)
604 .withDeliveryDateRoll(floatingLegData->deliveryRollDays())
605 .withFutureMonthOffset(floatingLegData->futureMonthOffset())
607 .payAtMaturity(floatingLegData->commodityPayRelativeTo() ==
609 .includeEndDate(floatingLegData->includePeriodEnd())
610 .excludeStartDate(floatingLegData->excludePeriodStart())
611 .withQuantityFrequency(floatingLegData->commodityQuantityFrequency())
612 .withPaymentDates(paymentDates)
613 .useBusinessDays(floatingLegData->useBusinessDays())
614 .withHoursPerDay(hoursPerDay)
615 .withDailyExpiryOffset(dailyExpOffset)
616 .unrealisedQuantity(floatingLegData->unrealisedQuantity())
617 .withOffPeakPowerData(offPeakPowerData)
618 .withFxIndex(fxIndex);
619 } else {
620 CommodityIndexedCashFlow::PaymentTiming paymentTiming = CommodityIndexedCashFlow::PaymentTiming::InArrears;
621 if (floatingLegData->commodityPayRelativeTo() == CommodityPayRelativeTo::CalculationPeriodStartDate) {
622 paymentTiming = CommodityIndexedCashFlow::PaymentTiming::InAdvance;
623 } else if (floatingLegData->commodityPayRelativeTo() == CommodityPayRelativeTo::CalculationPeriodEndDate) {
624 paymentTiming = CommodityIndexedCashFlow::PaymentTiming::InArrears;
625 } else if (floatingLegData->commodityPayRelativeTo() == CommodityPayRelativeTo::FutureExpiryDate) {
626 paymentTiming = CommodityIndexedCashFlow::PaymentTiming::RelativeToExpiry;
627 } else {
628 QL_FAIL("CommodityLegBuilder: CommodityPayRelativeTo " << floatingLegData->commodityPayRelativeTo()
629 << " not handled. This is an internal error.");
630 }
631
632 leg = CommodityIndexedLeg(schedule, index)
633 .withQuantities(quantities)
634 .withPaymentLag(boost::apply_visitor(PaymentLagInteger(), paymentLag))
635 .withPaymentCalendar(paymentCalendar)
636 .withPaymentConvention(paymentConvention)
637 .withPricingLag(floatingLegData->pricingLag())
638 .withPricingLagCalendar(pricingCalendar)
639 .withSpreads(spreads)
640 .withGearings(gearings)
641 .paymentTiming(paymentTiming)
642 .inArrears(floatingLegData->isInArrears())
644 .useFutureExpiryDate(floatingLegData->pricingDateRule() == CommodityPricingDateRule::FutureExpiryDate)
645 .withFutureMonthOffset(floatingLegData->futureMonthOffset())
647 .payAtMaturity(floatingLegData->commodityPayRelativeTo() == CommodityPayRelativeTo::TerminationDate)
649 .withPaymentDates(paymentDates)
650 .withDailyExpiryOffset(dailyExpOffset)
651 .withFxIndex(fxIndex)
652 .withIsAveraging(floatingLegData->isAveraged() && balanceOfTheMonth)
653 .withPricingCalendar(pricingCalendar)
654 .includeEndDate(floatingLegData->includePeriodEnd())
655 .excludeStartDate(floatingLegData->excludePeriodStart());
656
657 // Possibly update the leg's quantities.
658 updateQuantities(leg, allAveraging_, floatingLegData->commodityQuantityFrequency(), schedule,
659 floatingLegData->excludePeriodStart(), floatingLegData->includePeriodEnd(), commFutureConv,
660 feCalc, hoursPerDay, floatingLegData->useBusinessDays(), daylightSavingLocation, commName,
661 floatingLegData->unrealisedQuantity(), offPeakPowerData);
662
663 // If lastNDays is set, amend each cashflow in the leg to an averaging cashflow over the lastNDays.
664 auto lastNDays = floatingLegData->lastNDays();
665 if (lastNDays != Null<Natural>() && lastNDays > 1) {
666 if (commFutureConv) {
667 if (lastNDays > 31) {
668 WLOG("LastNDays (" << lastNDays << ") should not be greater than 31. " <<
669 "Proceed as if it is not set.");
670 } else if (commFutureConv->isAveraging()) {
671 WLOG("Commodity future convention for " << commName << " is averaging so LastNDays (" <<
672 lastNDays << ") is ignored. Proceed as if it is not set.");
673 } else {
674 DLOG("Amending cashflows to account for LastNDays (" << lastNDays << ").");
675 const auto& cal = commFutureConv->calendar();
676 for (auto& cf : leg) {
677 auto ccf = QuantLib::ext::dynamic_pointer_cast<CommodityIndexedCashFlow>(cf);
678 const Date& endDate = ccf->pricingDate();
679 Date startDate = cal.advance(endDate, -static_cast<Integer>(lastNDays) + 1, Days, Preceding);
680 TLOG("Creating cashflow averaging over period [" << io::iso_date(startDate) <<
681 "," << io::iso_date(endDate) << "]");
682 cf = QuantLib::ext::make_shared<CommodityIndexedAverageCashFlow>(ccf->periodQuantity(), startDate,
683 endDate, ccf->date(), ccf->index(), cal, ccf->spread(), ccf->gearing(),
684 ccf->useFuturePrice(), 0, 0, feCalc, true, false);
685 }
686 }
687 } else {
688 WLOG("Need a commodity future convention for " << commName << " when LastNDays (" << lastNDays <<
689 ") is set and greater than 1. Proceed as if it is not set.");
690 }
691 }
692 }
693
694 if (fxIndex) {
695 // fx daily indexing needed
696 for (auto cf : leg) {
697 auto cacf = QuantLib::ext::dynamic_pointer_cast<CommodityCashFlow>(cf);
698 QL_REQUIRE(cacf, "Commodity Indexed averaged cashflow is required to compute daily converted average.");
699 for (auto kv : cacf->indices()) {
700 if (!fxIndex->fixingCalendar().isBusinessDay(
701 kv.first)) {
702 /* If fx index is not available for the commodity pricing day, this ensures to require the previous
703 * valid one which will be used in pricing from fxIndex()->fixing(...) */
704 Date adjustedFixingDate = fxIndex->fixingCalendar().adjust(kv.first, Preceding);
705 requiredFixings.addFixingDate(adjustedFixingDate, floatingLegData->fxIndex());
706 } else
707 requiredFixings.addFixingDate(kv.first, floatingLegData->fxIndex());
708 }
709 }
710 } else {
711 // standard indexing approach
712 applyIndexing(leg, data, engineFactory, requiredFixings, openEndDateReplacement, useXbsCurves);
713 }
714
715 addToRequiredFixings(leg, QuantLib::ext::make_shared<FixingDateGetter>(requiredFixings));
716 return leg;
717}
CommodityIndexedAverageLeg & useFuturePrice(bool flag=false)
CommodityIndexedAverageLeg & withPaymentLag(QuantLib::Natural paymentLag)
CommodityIndexedAverageLeg & includeEndDate(bool flag=true)
CommodityIndexedAverageLeg & excludeStartDate(bool flag=true)
CommodityIndexedAverageLeg & withFutureMonthOffset(QuantLib::Natural futureMonthOffset)
CommodityIndexedAverageLeg & withGearings(QuantLib::Real gearing)
CommodityIndexedAverageLeg & paymentTiming(CommodityIndexedAverageCashFlow::PaymentTiming paymentTiming)
CommodityIndexedAverageLeg & withDeliveryDateRoll(QuantLib::Natural deliveryDateRoll)
CommodityIndexedAverageLeg & withQuantityFrequency(CommodityQuantityFrequency quantityFrequency)
CommodityIndexedAverageLeg & withPaymentConvention(QuantLib::BusinessDayConvention paymentConvention)
CommodityIndexedAverageLeg & withPaymentDates(const std::vector< QuantLib::Date > &paymentDates)
CommodityIndexedAverageLeg & withDailyExpiryOffset(QuantLib::Natural dailyExpiryOffset)
CommodityIndexedAverageLeg & withQuantities(QuantLib::Real quantity)
CommodityIndexedAverageLeg & withPaymentCalendar(const QuantLib::Calendar &paymentCalendar)
CommodityIndexedAverageLeg & withHoursPerDay(QuantLib::Natural hoursPerDay)
CommodityIndexedAverageLeg & useBusinessDays(bool flag=true)
CommodityIndexedAverageLeg & withFutureExpiryCalculator(const ext::shared_ptr< FutureExpiryCalculator > &calc=nullptr)
CommodityIndexedAverageLeg & withPricingCalendar(const QuantLib::Calendar &pricingCalendar)
CommodityIndexedAverageLeg & withSpreads(QuantLib::Real spread)
CommodityIndexedAverageLeg & unrealisedQuantity(bool flag=false)
CommodityIndexedAverageLeg & withOffPeakPowerData(const boost::optional< std::pair< QuantLib::Calendar, QuantLib::Real > > &offPeakPowerData)
CommodityIndexedAverageLeg & withFxIndex(const ext::shared_ptr< FxIndex > &fxIndex)
CommodityIndexedAverageLeg & payAtMaturity(bool flag=false)
CommodityIndexedLeg & excludeStartDate(bool flag=true)
CommodityIndexedLeg & withPricingLagCalendar(const QuantLib::Calendar &pricingLagCalendar)
CommodityIndexedLeg & paymentTiming(CommodityIndexedCashFlow::PaymentTiming paymentTiming)
CommodityIndexedLeg & payAtMaturity(bool flag=false)
CommodityIndexedLeg & withIsAveraging(const bool isAveraging)
CommodityIndexedLeg & includeEndDate(bool flag=true)
CommodityIndexedLeg & withFutureMonthOffset(QuantLib::Natural futureMonthOffset)
CommodityIndexedLeg & withQuantities(QuantLib::Real quantity)
CommodityIndexedLeg & withPaymentDates(const std::vector< QuantLib::Date > &paymentDates)
CommodityIndexedLeg & withFxIndex(const ext::shared_ptr< FxIndex > &fxIndex)
CommodityIndexedLeg & withFutureExpiryCalculator(const ext::shared_ptr< FutureExpiryCalculator > &calc=nullptr)
CommodityIndexedLeg & withPaymentLag(QuantLib::Natural paymentLag)
CommodityIndexedLeg & inArrears(bool flag=true)
CommodityIndexedLeg & withGearings(QuantLib::Real gearing)
CommodityIndexedLeg & withDailyExpiryOffset(QuantLib::Natural dailyExpiryOffset)
CommodityIndexedLeg & withPaymentCalendar(const QuantLib::Calendar &paymentCalendar)
CommodityIndexedLeg & withPricingDates(const std::vector< QuantLib::Date > &pricingDates)
CommodityIndexedLeg & withSpreads(QuantLib::Real spread)
CommodityIndexedLeg & useFuturePrice(bool flag=false)
CommodityIndexedLeg & withPricingCalendar(const QuantLib::Calendar &pricingCalendar)
CommodityIndexedLeg & withPaymentConvention(QuantLib::BusinessDayConvention paymentConvention)
CommodityIndexedLeg & withPricingLag(QuantLib::Natural pricingLag)
CommodityIndexedLeg & useFutureExpiryDate(bool flag=true)
void addFixingDate(const QuantLib::Date &fixingDate, const std::string &indexName, const QuantLib::Date &payDate=Date::maxDate(), const bool alwaysAddIfPaysOnSettlement=false, const bool mandatoryFixing=true)
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
Definition: parsers.cpp:157
BusinessDayConvention parseBusinessDayConvention(const string &s)
Convert text to QuantLib::BusinessDayConvention.
Definition: parsers.cpp:173
PaymentLag parsePaymentLag(const string &s)
Convert text to PaymentLag.
Definition: parsers.cpp:628
@ data
Definition: log.hpp:77
#define DLOG(text)
Logging Macro (Level = Debug)
Definition: log.hpp:554
#define WLOG(text)
Logging Macro (Level = Warning)
Definition: log.hpp:550
#define TLOG(text)
Logging Macro (Level = Data)
Definition: log.hpp:556
set< Date > pricingDates(const Date &s, const Date &e, const Calendar &pricingCalendar, bool excludeStart, bool includeEnd, bool useBusinessDays)
void applyIndexing(Leg &leg, const LegData &data, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, RequiredFixings &requiredFixings, const QuantLib::Date &openEndDateReplacement, const bool useXbsCurves)
Definition: legdata.cpp:2633
void addToRequiredFixings(const QuantLib::Leg &leg, const QuantLib::ext::shared_ptr< FixingDateGetter > &fixingDateGetter)
vector< T > buildScheduledVector(const vector< T > &values, const vector< string > &dates, const Schedule &schedule, const bool checkAllValuesAppearInResult=false)
Definition: legdata.hpp:1061
QuantLib::ext::shared_ptr< QuantExt::CommodityIndex > parseCommodityIndex(const string &name, bool hasPrefix, const Handle< PriceTermStructure > &ts, const Calendar &cal, const bool enforceFutureIndex)
boost::variant< QuantLib::Period, QuantLib::Natural > PaymentLag
Definition: types.hpp:32
QuantLib::ext::shared_ptr< QuantExt::FxIndex > buildFxIndex(const string &fxIndex, const string &domestic, const string &foreign, const QuantLib::ext::shared_ptr< Market > &market, const string &configuration, bool useXbsCurves)
Definition: marketdata.cpp:137
Schedule makeSchedule(const ScheduleDates &data)
Definition: schedule.cpp:263
+ Here is the call graph for this function:

◆ allAveraging()

bool allAveraging ( ) const

Inspect the allAveraging_ flag.

Definition at line 56 of file commoditylegbuilder.hpp.

56{ return allAveraging_; }

Member Data Documentation

◆ allAveraging_

bool allAveraging_
mutableprivate

A flag that is set if the leg is averaging and the conventions indicate that the commodity contract itself on which the leg is based is averaging. This flag is false in all other circumstances.

Definition at line 62 of file commoditylegbuilder.hpp.