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

Commodity forward quote class. More...

#include <ored/marketdata/marketdatum.hpp>

+ Inheritance diagram for CommodityForwardQuote:
+ Collaboration diagram for CommodityForwardQuote:

Public Member Functions

 CommodityForwardQuote ()
 
 CommodityForwardQuote (QuantLib::Real value, const QuantLib::Date &asofDate, const std::string &name, QuoteType quoteType, const std::string &commodityName, const std::string &quoteCurrency, const QuantLib::Date &expiryDate)
 Date based commodity forward constructor. More...
 
 CommodityForwardQuote (QuantLib::Real value, const QuantLib::Date &asofDate, const std::string &name, QuoteType quoteType, const std::string &commodityName, const std::string &quoteCurrency, const QuantLib::Period &tenor, boost::optional< QuantLib::Period > startTenor=boost::none)
 Tenor based commodity forward constructor. More...
 
QuantLib::ext::shared_ptr< MarketDatumclone () override
 Make a copy of the market datum. More...
 
- Public Member Functions inherited from MarketDatum
 MarketDatum ()
 
 MarketDatum (Real value, Date asofDate, const string &name, QuoteType quoteType, InstrumentType instrumentType)
 Constructor. More...
 
virtual ~MarketDatum ()
 Default destructor. More...
 
virtual QuantLib::ext::shared_ptr< MarketDatumclone ()
 Make a copy of the market datum. More...
 
const string & name () const
 
const Handle< Quote > & quote () const
 
Date asofDate () const
 
InstrumentType instrumentType () const
 
QuoteType quoteType () const
 

Inspectors

std::string commodityName_
 
std::string quoteCurrency_
 
QuantLib::Date expiryDate_
 
QuantLib::Period tenor_
 
boost::optional< QuantLib::Period > startTenor_
 
bool tenorBased_
 
class boost::serialization::access
 Serialization. More...
 
const std::string & commodityName () const
 
const std::string & quoteCurrency () const
 
const QuantLib::Date & expiryDate () const
 The commodity forward's expiry if the quote is date based. More...
 
const QuantLib::Period & tenor () const
 The commodity forward's tenor if the quote is tenor based. More...
 
const boost::optional< QuantLib::Period > & startTenor () const
 
bool tenorBased () const
 Returns true if the forward is tenor based and false if forward is date based. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Additional Inherited Members

- Public Types inherited from MarketDatum
enum class  InstrumentType {
  ZERO , DISCOUNT , MM , MM_FUTURE ,
  OI_FUTURE , FRA , IMM_FRA , IR_SWAP ,
  BASIS_SWAP , BMA_SWAP , CC_BASIS_SWAP , CC_FIX_FLOAT_SWAP ,
  CDS , CDS_INDEX , FX_SPOT , FX_FWD ,
  HAZARD_RATE , RECOVERY_RATE , SWAPTION , CAPFLOOR ,
  FX_OPTION , ZC_INFLATIONSWAP , ZC_INFLATIONCAPFLOOR , YY_INFLATIONSWAP ,
  YY_INFLATIONCAPFLOOR , SEASONALITY , EQUITY_SPOT , EQUITY_FWD ,
  EQUITY_DIVIDEND , EQUITY_OPTION , BOND , BOND_OPTION ,
  INDEX_CDS_OPTION , COMMODITY_SPOT , COMMODITY_FWD , CORRELATION ,
  COMMODITY_OPTION , CPR , RATING , NONE
}
 Supported market instrument types. More...
 
enum class  QuoteType {
  BASIS_SPREAD , CREDIT_SPREAD , CONV_CREDIT_SPREAD , YIELD_SPREAD ,
  HAZARD_RATE , RATE , RATIO , PRICE ,
  RATE_LNVOL , RATE_NVOL , RATE_SLNVOL , BASE_CORRELATION ,
  SHIFT , TRANSITION_PROBABILITY , NONE
}
 Supported market quote types. More...
 
- Protected Attributes inherited from MarketDatum
Handle< Quote > quote_
 
Date asofDate_
 
string name_
 
InstrumentType instrumentType_
 
QuoteType quoteType_
 

Detailed Description

Commodity forward quote class.

This class holds a forward price for a commodity in a given currency

Definition at line 1730 of file marketdatum.hpp.

Constructor & Destructor Documentation

◆ CommodityForwardQuote() [1/3]

Definition at line 1732 of file marketdatum.hpp.

1732{}

◆ CommodityForwardQuote() [2/3]

CommodityForwardQuote ( QuantLib::Real  value,
const QuantLib::Date &  asofDate,
const std::string &  name,
QuoteType  quoteType,
const std::string &  commodityName,
const std::string &  quoteCurrency,
const QuantLib::Date &  expiryDate 
)

Date based commodity forward constructor.

Definition at line 207 of file marketdatum.cpp.

212 QL_REQUIRE(quoteType == QuoteType::PRICE, "Commodity forward quote must be of type 'PRICE'");
213 QL_REQUIRE(asofDate <= expiryDate, "MarketDatumParser: Invalid COMMODITY_FWD quote, expiry date "
214 << expiryDate << " must be after asof date " << asofDate);
215}
const QuantLib::Date & expiryDate() const
The commodity forward's expiry if the quote is date based.
const std::string & commodityName() const
const std::string & quoteCurrency() const
const string & name() const
QuoteType quoteType() const
SafeStack< ValueType > value
+ Here is the call graph for this function:

◆ CommodityForwardQuote() [3/3]

CommodityForwardQuote ( QuantLib::Real  value,
const QuantLib::Date &  asofDate,
const std::string &  name,
QuoteType  quoteType,
const std::string &  commodityName,
const std::string &  quoteCurrency,
const QuantLib::Period &  tenor,
boost::optional< QuantLib::Period >  startTenor = boost::none 
)

Tenor based commodity forward constructor.

Definition at line 218 of file marketdatum.cpp.

223 QL_REQUIRE(quoteType == QuoteType::PRICE, "Commodity forward quote must be of type 'PRICE'");
224}
const boost::optional< QuantLib::Period > & startTenor() const
const QuantLib::Period & tenor() const
The commodity forward's tenor if the quote is tenor based.
boost::optional< QuantLib::Period > startTenor_
+ Here is the call graph for this function:

Member Function Documentation

◆ clone()

QuantLib::ext::shared_ptr< MarketDatum > clone ( )
overridevirtual

Make a copy of the market datum.

Reimplemented from MarketDatum.

Definition at line 1744 of file marketdatum.hpp.

1744 {
1745 if (tenorBased_) {
1746 return QuantLib::ext::make_shared<CommodityForwardQuote>(quote_->value(), asofDate_, name_, quoteType_, commodityName_, quoteCurrency_, tenor_, startTenor_);
1747 } else {
1748 return QuantLib::ext::make_shared<CommodityForwardQuote>(quote_->value(), asofDate_, name_, quoteType_, commodityName_, quoteCurrency_, expiryDate_);
1749 }
1750 }
Handle< Quote > quote_

◆ commodityName()

const std::string & commodityName ( ) const

Definition at line 1754 of file marketdatum.hpp.

1754{ return commodityName_; }

◆ quoteCurrency()

const std::string & quoteCurrency ( ) const

Definition at line 1755 of file marketdatum.hpp.

1755{ return quoteCurrency_; }

◆ expiryDate()

const QuantLib::Date & expiryDate ( ) const

The commodity forward's expiry if the quote is date based.

Definition at line 1758 of file marketdatum.hpp.

1758{ return expiryDate_; }
+ Here is the caller graph for this function:

◆ tenor()

const QuantLib::Period & tenor ( ) const

The commodity forward's tenor if the quote is tenor based.

Definition at line 1761 of file marketdatum.hpp.

1761{ return tenor_; }

◆ startTenor()

const boost::optional< QuantLib::Period > & startTenor ( ) const

The period between the as of date and the date from which the forward tenor is applied. This is generally the spot tenor which is indicated by boost::none but there are special cases:

  • overnight forward: startTenor will be 0 * Days and tenor will be 1 * Days
  • tom-next forward: startTenor will be 1 * Days and tenor will be 1 * Days

Definition at line 1768 of file marketdatum.hpp.

1768{ return startTenor_; }

◆ tenorBased()

bool tenorBased ( ) const

Returns true if the forward is tenor based and false if forward is date based.

Definition at line 1771 of file marketdatum.hpp.

1771{ return tenorBased_; }

◆ serialize()

template void serialize ( Archive &  ar,
const unsigned int  version 
)
private

Definition at line 614 of file marketdatum.cpp.

614 {
615 ar& boost::serialization::base_object<MarketDatum>(*this);
616 ar& commodityName_;
617 ar& quoteCurrency_;
618 ar& expiryDate_;
619 ar& tenor_;
620 ar& startTenor_;
621 ar& tenorBased_;
622}

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialization.

Definition at line 1782 of file marketdatum.hpp.

Member Data Documentation

◆ commodityName_

std::string commodityName_
private

Definition at line 1775 of file marketdatum.hpp.

◆ quoteCurrency_

std::string quoteCurrency_
private

Definition at line 1776 of file marketdatum.hpp.

◆ expiryDate_

QuantLib::Date expiryDate_
private

Definition at line 1777 of file marketdatum.hpp.

◆ tenor_

QuantLib::Period tenor_
private

Definition at line 1778 of file marketdatum.hpp.

◆ startTenor_

boost::optional<QuantLib::Period> startTenor_
private

Definition at line 1779 of file marketdatum.hpp.

◆ tenorBased_

bool tenorBased_
private

Definition at line 1780 of file marketdatum.hpp.