24#ifndef quantlib_commodity_pricing_helpers_hpp
25#define quantlib_commodity_pricing_helpers_hpp
42 const Date& evaluationDate);
53 const Date& evaluationDate);
69 if (toUnitOfMeasure != fromUnitOfMeasure) {
72 commodityType, fromUnitOfMeasure, toUnitOfMeasure);
82 const Date& evaluationDate) {
83 if (fromCurrency != toCurrency) {
89 if (fromCurrency != exchRate.
source())
91 return exchRate.
rate();
101 const Date& evaluationDate) {
103 Real unitCostUomConversionFactor =
107 Real unitCostFxConversionFactor =
109 baseCurrency, evaluationDate);
110 return unitCost.
amount().
value() * unitCostUomConversionFactor
111 * unitCostFxConversionFactor;
static Real calculateUomConversionFactor(const CommodityType &commodityType, const UnitOfMeasure &fromUnitOfMeasure, const UnitOfMeasure &toUnitOfMeasure)
static void createPricingPeriods(Date startDate, Date endDate, const Quantity &quantity, EnergyCommodity::DeliverySchedule deliverySchedule, EnergyCommodity::QuantityPeriodicity qtyPeriodicity, const PaymentTerm &paymentTerm, PricingPeriods &pricingPeriods)
static Real calculateUnitCost(const CommodityType &commodityType, const CommodityUnitCost &unitCost, const Currency &baseCurrency, const UnitOfMeasure &baseUnitOfMeasure, const Date &evaluationDate)
static Real calculateFxConversionFactor(const Currency &fromCurrency, const Currency &toCurrency, const Date &evaluationDate)
const Money & amount() const
const UnitOfMeasure & unitOfMeasure() const
exchange rate between two currencies
Decimal rate() const
the exchange rate (when available)
const Currency & source() const
the source currency.
ExchangeRate lookup(const Currency &source, const Currency &target, Date date=Date(), ExchangeRate::Type type=ExchangeRate::Derived) const
const Currency & currency() const
static UnitOfMeasureConversionManager & instance()
access to the unique instance
Real conversionFactor() const
the conversion factor
UnitOfMeasureConversion lookup(const CommodityType &commodityType, const UnitOfMeasure &, const UnitOfMeasure &, UnitOfMeasureConversion::Type type=UnitOfMeasureConversion::Derived) const
Unit of measure specification
std::vector< ext::shared_ptr< PricingPeriod > > PricingPeriods
Unit-of-measure conversion manager.