QuantLib: CommodityIndex Class Reference

A free/open-source library for quantitative finance Reference manual - version 1.12

Public Member Functions | Protected Attributes | Friends | List of all members
CommodityIndex Class Reference

base class for commodity indexes More...

`#include <ql/experimental/commodities/commodityindex.hpp>`

Inheritance diagram for CommodityIndex:
[legend]

## Public Member Functions
| CommodityIndex (const std::string &name, const CommodityType &commodityType, const Currency &currency, const UnitOfMeasure &unitOfMeasure, const Calendar &calendar, Real lotQuantity, const boost::shared_ptr< CommodityCurve > &forwardCurve, const boost::shared_ptr< ExchangeContracts > &exchangeContracts, int nearbyOffset)
void | addQuote (const Date &quoteDate, Real quote)
void | addQuotes (const std::map< Date, Real > &quotes)
void | clearQuotes ()
bool | isValidQuoteDate (const Date &quoteDate) const
| returns TRUE if the quote date is valid
bool | empty () const
bool | forwardCurveEmpty () const
const TimeSeries< Real > & | quotes () const
Index interface
std::string | name () const
Observer interface
void | update ()
Inspectors
const CommodityType & | commodityType () const
const Currency & | currency () const
const UnitOfMeasure & | unitOfMeasure () const
const Calendar & | calendar () const
const boost::shared_ptr< CommodityCurve > & | forwardCurve () const
Real | lotQuantity () const
Real | price (const Date &date)
Real | forwardPrice (const Date &date) const
Date | lastQuoteDate () const
Public Member Functions inherited from Observable
| Observable (const Observable &)
Observable & | operator= (const Observable &)
void | notifyObservers ()
Public Member Functions inherited from Observer
| Observer (const Observer &)
Observer & | operator= (const Observer &)
std::pair< iterator, bool > | registerWith (const boost::shared_ptr< Observable > &)
void | registerWithObservables (const boost::shared_ptr< Observer > &)
Size | unregisterWith (const boost::shared_ptr< Observable > &)
void | unregisterWithAll ()
virtual void | deepUpdate ()

## Protected Attributes
std::string | name_
CommodityType | commodityType_
UnitOfMeasure | unitOfMeasure_
Currency | currency_
Calendar | calendar_
Real | lotQuantity_
TimeSeries< Real > | quotes_
boost::shared_ptr< CommodityCurve > | forwardCurve_
Real | forwardCurveUomConversionFactor_
boost::shared_ptr< ExchangeContracts > | exchangeContracts_
Integer | nearbyOffset_

## Friends
std::ostream & | operator<< (std::ostream &, const CommodityIndex &)

## Additional Inherited Members
Public Types inherited from Observer
typedef std::set< boost::shared_ptr< Observable > > | set_type
typedef set_type::iterator | iterator

## Detailed Description

base class for commodity indexes

## Member Function Documentation

## ◆ update()

void update | ( |  | ) |
| virtual

This method must be implemented in derived classes. An instance of Observer does not call this method directly: instead, it will be called by the observables the instance registered with when they need to notify any changes.

Implements Observer.