24#ifndef quantlib_commodity_index_hpp
25#define quantlib_commodity_index_hpp
45 ext::shared_ptr<ExchangeContracts> exchangeContracts,
49 std::string
name()
const;
61 const ext::shared_ptr<CommodityCurve>&
forwardCurve()
const;
71 std::string tag =
name();
73 for (
auto quote :
quotes) {
74 quotes_[quote.first] = quote.second;
136 inline const ext::shared_ptr<CommodityCurve>&
161 }
catch (
const std::exception& e) {
162 QL_FAIL(
"error fetching forward price for index " <<
name_
163 <<
": " << e.what());
187 std::string tag =
name();
bool isBusinessDay(const Date &d) const
base class for commodity indexes
const TimeSeries< Real > & quotes() const
UnitOfMeasure unitOfMeasure_
Date lastQuoteDate() const
Real forwardCurveUomConversionFactor_
const Calendar & calendar() const
const Currency & currency() const
const ext::shared_ptr< CommodityCurve > & forwardCurve() const
ext::shared_ptr< ExchangeContracts > exchangeContracts_
void addQuote(const Date "eDate, Real quote)
CommodityType commodityType_
bool isValidQuoteDate(const Date "eDate) const
returns TRUE if the quote date is valid
Real price(const Date &date)
void addQuotes(const std::map< Date, Real > "es)
TimeSeries< Real > quotes_
const CommodityType & commodityType() const
Real forwardPrice(const Date &date) const
ext::shared_ptr< CommodityCurve > forwardCurve_
bool forwardCurveEmpty() const
const UnitOfMeasure & unitOfMeasure() const
friend std::ostream & operator<<(std::ostream &, const CommodityIndex &)
static Date minDate()
earliest allowed date
const TimeSeries< Real > & getHistory(const std::string &name) const
returns the (possibly empty) history of the index fixings
void setHistory(const std::string &name, TimeSeries< Real > history)
stores the historical fixings of the index
void clearHistory(const std::string &name)
clears the historical fixings of the index
template class providing a null value for a given type.
Object that notifies its changes to a set of observers.
Object that gets notified when a given observable changes.
static IndexManager & instance()
access to the unique instance
Container for historical data.
const_iterator find(const Date &)
bool empty() const
returns whether the series contains any data
Date lastDate() const
returns the last date for which a historical datum exists
const_iterator end() const
Unit of measure specification
#define QL_FAIL(message)
throw an error (possibly with file and line information)
QL_INTEGER Integer
integer number
global repository for past index fixings
bool operator==(const Currency &c1, const Currency &c2)