Logo
Reference manual - version ored_version
Files | Classes | Functions
Utilities

Files

file  iborfallbackconfig.hpp
 ibor fallback configuration
 
file  calendaradjustmentconfig.hpp
 Interface for calendar modifications, additional holidays and business days.
 
file  conventionsbasedfutureexpiry.hpp
 Base class for classes that perform date calculations for future contracts.
 
file  correlationmatrix.hpp
 configuration class for building correlation matrices
 
file  csvfilereader.hpp
 utility class to acess CSV files
 
file  currencycheck.hpp
 utility class to check whether string is ISO 4217 compliant
 
file  calendaradjustmentconfig.hpp
 Interface for calendar modifications, additional holidays and business days.
 
file  flowanalysis.hpp
 Extended QuantLib flow analysis.
 
file  indexparser.hpp
 Map text representations to QuantLib/QuantExt types.
 
file  log.hpp
 Classes and functions for log message handling.
 
file  marketdata.hpp
 market data related utilties
 
file  osutils.hpp
 Various OS specific utilities.
 
file  parsers.hpp
 Map text representations to QuantLib/QuantExt types.
 
file  progressbar.hpp
 Classes for progress reporting.
 
file  serializationdate.hpp
 support for QuantLib::Date serialization
 
file  serializationdaycounter.hpp
 support for QuantLib::DayCounter serialization
 
file  serializationperiod.hpp
 support for QuantLib::Period serialization
 
file  strike.hpp
 strike description
 
file  timeperiod.hpp
 non-contiguous time period handling
 
file  to_string.hpp
 string conversion utilities
 
file  vectorutils.hpp
 Utilities for sorting vectors using permutations.
 
file  wildcard.hpp
 utilities for wildcard handling
 
file  xmlutils.hpp
 XML utility functions.
 

Classes

class  CorrelationMatrixBuilder
 
class  Logger
 The Base Custom Log Handler class. More...
 
class  StderrLogger
 Stderr Logger. More...
 
class  FileLogger
 FileLogger. More...
 
class  BufferLogger
 BufferLogger. More...
 
class  Log
 Global static Log class. More...
 
class  ProgressIndicator
 Abstract Base class for a Progress Indicator. More...
 
class  ProgressReporter
 Base class for a Progress Reporter. More...
 
class  SimpleProgressBar
 Simple Progress Bar. More...
 
class  ProgressLog
 Progress Logger that writes the progress using the LOG macro. More...
 
class  TimePeriod
 Handles non-contiguous time period. More...
 
class  xml_node< Ch >
 XML Node. More...
 
class  xml_document< Ch >
 XML Document. More...
 
class  XMLDocument
 Small XML Document wrapper class. More...
 
class  XMLSerializable
 Base class for all serializable classes. More...
 
class  XMLUtils
 XML Utilities Class. More...
 

Functions

bool tryParseCdsInformation (const std::string &strInfo, CdsReferenceInformation &cdsInfo)
 
bool checkCurrency (const string &s)
 Currency Check. More...
 
bool checkMinorCurrency (const string &s)
 Minor Currency Check. More...
 
QuantLib::Real convertMinorToMajorCurrency (const std::string &s, QuantLib::Real value)
 Convert a value from a minor ccy to major. More...
 
std::vector< std::vector< std::string > > flowAnalysis (const QuantLib::Leg &)
 Flow Analysis.
 
boost::shared_ptr< QuantExt::FxIndexparseFxIndex (const string &s, const Handle< Quote > &fxSpot=Handle< Quote >(), const Handle< YieldTermStructure > &sourceYts=Handle< YieldTermStructure >(), const Handle< YieldTermStructure > &targetYts=Handle< YieldTermStructure >())
 Convert std::string to QuantExt::FxIndex.
 
boost::shared_ptr< IborIndexparseIborIndex (const string &s, const Handle< YieldTermStructure > &h=Handle< YieldTermStructure >(), const boost::shared_ptr< Convention > &c=nullptr)
 Convert std::string to QuantLib::IborIndex.
 
boost::shared_ptr< IborIndexparseIborIndex (const std::string &strIndex, std::string &outTenor, const QuantLib::Handle< QuantLib::YieldTermStructure > &h=QuantLib::Handle< QuantLib::YieldTermStructure >(), const boost::shared_ptr< Convention > &c=nullptr)
 Convert std::string to QuantLib::IborIndex and return the tenor string component of the index. More...
 
bool tryParseIborIndex (const string &s, boost::shared_ptr< IborIndex > &index, const boost::shared_ptr< Convention > &c=nullptr)
 Try to convert std::string to QuantLib::IborIndex.
 
bool isGenericIborIndex (const string &indexName)
 Return true if the indexName is that of a generic ibor index, otherwise false.
 
std::pair< bool, boost::shared_ptr< QuantLib::ZeroInflationIndex > > isInflationIndex (const std::string &indexName, const boost::shared_ptr< Conventions > &conventions=nullptr)
 
bool isEquityIndex (const std::string &indexName)
 Return true if the indexName is that of an EquityIndex, otherwise false.
 
bool isGenericIndex (const std::string &indexName)
 
boost::shared_ptr< QuantExt::EquityIndexparseEquityIndex (const string &s)
 Convert std::string (e.g SP5) to QuantExt::EquityIndex.
 
boost::shared_ptr< SwapIndex > parseSwapIndex (const string &s, const Handle< YieldTermStructure > &forwarding=Handle< YieldTermStructure >(), const Handle< YieldTermStructure > &discounting=Handle< YieldTermStructure >(), boost::shared_ptr< IRSwapConvention > irSwapConvention=nullptr, boost::shared_ptr< SwapIndexConvention > swapIndexConvention=nullptr)
 Convert std::string to QuantLib::SwapIndex.
 
boost::shared_ptr< ZeroInflationIndex > parseZeroInflationIndex (const string &s, bool isInterpolated=false, const Handle< ZeroInflationTermStructure > &h=Handle< ZeroInflationTermStructure >(), const boost::shared_ptr< Conventions > &conventions=nullptr)
 Convert std::string to QuantLib::ZeroInflationIndex.
 
boost::shared_ptr< QuantExt::BondIndexparseBondIndex (const string &s)
 Convert std::string to QuantExt::BondIndex.
 
boost::shared_ptr< QuantExt::CommodityIndexparseCommodityIndex (const std::string &name, bool hasPrefix=true, const QuantLib::Calendar &cal=QuantLib::NullCalendar(), const QuantLib::Handle< QuantExt::PriceTermStructure > &ts=QuantLib::Handle< QuantExt::PriceTermStructure >(), const Conventions &conventions=Conventions())
 
boost::shared_ptr< QuantLib::Index > parseGenericIndex (const string &s)
 Convert std::string (GENERIC-...) to QuantExt::Index.
 
boost::shared_ptr< IndexparseIndex (const string &s, const boost::shared_ptr< Conventions > &conventions=nullptr)
 Convert std::string to QuantLib::Index.
 
bool isOvernightIndex (const std::string &indexName, const Conventions &conventions=Conventions())
 Return true if the indexName is that of an overnight index, otherwise false.
 
bool isBmaIndex (const std::string &indexName)
 Return true if the indexName is that of an bma/sifma index, otherwise false.
 
std::string internalIndexName (const std::string &indexName)
 
std::string getOsName ()
 Returns the OS Name.
 
std::string getOsVersion ()
 Returns the OS Version.
 
std::string getCpuName ()
 Returns the CPU name (e.g. "Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz".
 
unsigned int getNumberCores ()
 Returns the number of Cores available to the OS.
 
std::string getMemoryRAM ()
 Returns the total amount of memory available (installed RAM)
 
std::string getMemoryUsage ()
 Returns the current process memory usage.
 
std::string getPeakMemoryUsage ()
 Returns the current process peak memory usage.
 
unsigned long long getMemoryUsageBytes ()
 
unsigned long long getPeakMemoryUsageBytes ()
 Returns the current process peak memory usage in bytes.
 
std::string getUsername ()
 Returns the current username.
 
std::string getHostname ()
 Returns the machine name.
 
std::string getSystemDetails ()
 Returns all the above system details in a single string.
 
QuantLib::Date parseDate (const string &s)
 Convert std::string to QuantLib::Date.
 
QuantLib::Real parseReal (const string &s)
 Convert text to Real.
 
bool tryParseReal (const string &s, QuantLib::Real &result)
 Attempt to convert text to Real. More...
 
QuantLib::Integer parseInteger (const string &s)
 Convert text to QuantLib::Integer.
 
bool parseBool (const string &s)
 Convert text to bool.
 
QuantLib::Calendar parseCalendar (const string &s, const string &newName="")
 Convert text to QuantLib::Calendar. More...
 
QuantLib::Period parsePeriod (const string &s)
 Convert text to QuantLib::Period.
 
QuantLib::BusinessDayConvention parseBusinessDayConvention (const string &s)
 Convert text to QuantLib::BusinessDayConvention.
 
QuantLib::DayCounter parseDayCounter (const string &s)
 Convert text to QuantLib::DayCounter.
 
QuantLib::Currency parseCurrency (const string &s, const Currency &currency=QuantLib::Currency())
 Convert text to QuantLib::Currency.
 
QuantLib::Currency parseMinorCurrency (const string &s)
 Convert text to QuantLib::Currency for minor currencies e.g GBp -> GBPCurrency()
 
QuantLib::Currency parseCurrencyWithMinors (const string &s)
 Convert text to QuantLib::Currency.
 
QuantLib::DateGeneration::Rule parseDateGenerationRule (const string &s)
 Convert text to QuantLib::DateGeneration::Rule.
 
QuantLib::Frequency parseFrequency (const string &s)
 Convert text to QuantLib::Frequency.
 
QuantLib::Compounding parseCompounding (const string &s)
 Convert text to QuantLib::Compounding;.
 
QuantLib::Position::Type parsePositionType (const string &s)
 Convert text to QuantLib::Position::Type.
 
QuantLib::Protection::Side parseProtectionSide (const string &s)
 Convert text to QuantLib::Protection::Side.
 
QuantLib::Settlement::Type parseSettlementType (const string &s)
 Convert text to QuantLib::Settlement::Type.
 
QuantLib::Settlement::Method parseSettlementMethod (const string &s)
 Convert text to QuantLib::Settlement::Method.
 
QuantLib::Exercise::Type parseExerciseType (const string &s)
 Convert text to QuantLib::Exercise::Type.
 
QuantLib::Option::Type parseOptionType (const string &s)
 Convert text to QuantLib::Option::Type.
 
boost::variant< QuantLib::Date, QuantLib::Period > parseDateOrPeriod (const string &s)
 Convert text to QuantLib::Period or QuantLib::Date.
 
void parseDateOrPeriod (const string &s, QuantLib::Date &d, QuantLib::Period &p, bool &isDate)
 Convert text to QuantLib::Period or QuantLib::Date (deprecated version)
 
QuantLib::LsmBasisSystem::PolynomType parsePolynomType (const std::string &s)
 Convert text to QuantLib::LsmBasisSystem::PolynomType.
 
QuantLib::SobolBrownianGenerator::Ordering parseSobolBrownianGeneratorOrdering (const std::string &s)
 Convert text to QuantLib::SobolBrownianGenerator::Ordering.
 
QuantLib::SobolRsg::DirectionIntegers parseSobolRsgDirectionIntegers (const std::string &s)
 Convert text to QuantLib::SobolRsg::DirectionIntegers.
 
QuantLib::Weekday parseWeekday (const std::string &s)
 
QuantLib::Month parseMonth (const std::string &s)
 
template<class T >
std::vector< T > parseListOfValues (string s, std::function< T(string)> parser)
 Convert comma separated list of values to vector of values.
 
QuantExt::SequenceType parseSequenceType (const std::string &s)
 Convert string to sequence type.
 
QuantLib::CPI::InterpolationType parseObservationInterpolation (const std::string &s)
 Convert string to observation interpolation.
 
QuantLib::FdmSchemeDesc parseFdmSchemeDesc (const std::string &s)
 Convert string to fdm scheme desc.
 
AssetClass parseAssetClass (const std::string &s)
 Convert text to ore::data::AssetClass.
 
std::ostream & operator<< (std::ostream &os, AssetClass a)
 Write ore::data::AssetClass to stream.
 
QuantLib::DeltaVolQuote::AtmType parseAtmType (const std::string &s)
 Convert text to QuantLib::DeltaVolQuote::AtmType.
 
QuantLib::DeltaVolQuote::DeltaType parseDeltaType (const std::string &s)
 Convert text to QuantLib::DeltaVolQuote::DeltaType.
 
QuantLib::Rounding::Type parseRoundingType (const std::string &s)
 Convert text to QuantLib::Rounding.
 
template<class T >
bool tryParse (const std::string &str, T &obj, std::function< T(std::string)> parser)
 
QuantLib::VolatilityType parseVolatilityQuoteType (const std::string &s)
 
QuantLib::CapFloor::Type parseCapFloorType (const std::string &s)
 
QuantLib::YoYInflationCapFloor::Type parseYoYInflationCapFloorType (const std::string &s)
 
QuantExt::CrossAssetModelTypes::AssetType parseCamAssetType (const std::string &s)
 
std::pair< string, string > parseBoostAny (const boost::any &anyType)
 
QuantExt::CdsOption::StrikeType parseCdsOptionStrikeType (const std::string &s)
 
QuantLib::Average::Type parseAverageType (const std::string &s)
 
template<class Archive >
void serialize (Archive &ar, QuantLib::Date &d, const unsigned int)
 Allow for serialization of QuantLib::Date without amending its class (non-intrusive)
 
template<class Archive >
void serialize (Archive &ar, QuantLib::DayCounter &dc, const unsigned int)
 Allow for serialization of QuantLib::Period without amending its class (non-intrusive)
 
template<class Archive >
void serialize (Archive &ar, QuantLib::Period &p, const unsigned int)
 Allow for serialization of QuantLib::Period without amending its class (non-intrusive)
 
Strike parseStrike (const std::string &s)
 Convert text to Strike.
 
std::ostream & operator<< (std::ostream &out, const Strike &s)
 Convert Strike to text.
 
bool operator== (const Strike &s1, const Strike &s2)
 Logical comparison of strikes.
 
QuantLib::Real computeAbsoluteStrike (const Strike &s, const QuantLib::Real atm, const QuantLib::Real atmf)
 Convenience function that computes an aboslute strike.
 
std::string to_string (const QuantLib::Date &date)
 Convert QuantLib::Date to std::string. More...
 
std::string to_string (bool aBool)
 Convert bool to std::string. More...
 
template<class T >
std::string to_string (const T &t)
 Convert type to std::string. More...
 
template<typename T , typename Compare >
std::vector< std::size_t > sort_permutation (const std::vector< T > &vec, Compare &compare)
 
template<typename T >
std::vector< T > apply_permutation (const std::vector< T > &vec, const std::vector< std::size_t > &p)
 
template<typename T >
void apply_permutation_in_place (std::vector< T > &vec, const std::vector< std::size_t > &p)
 

Detailed Description

Grouping of all utility related classes, functions and files

Reference: http://stackoverflow.com/questions/17074324/how-can-i-sort-two-vectors-in-the-same-way-with-criteria-that-uses-only-one-of

Function Documentation

◆ tryParseCdsInformation()

bool ore::data::tryParseCdsInformation ( const std::string &  strInfo,
CdsReferenceInformation cdsInfo 
)

Attempt to parse string to CdsReferenceInformation

Parameters
[in]strInfoThe string we wish to convert to CdsReferenceInformation
[out]cdsInfoThe resulting CdsReferenceInformation if the parsing was successful.
Returns
true if the parsing was successful and false if not.

If the function receives a strInfo of the form ID|TIER|CCY|DOCCLAUSE with CCY being a valid ISO currency code, TIER being a valid CDS debt tier and DOCCLAUSE being a valid CDS documentation clause, the parsing should be successful.

◆ checkCurrency()

bool ore::data::checkCurrency ( const string &  s)

Currency Check.

check whether string is ISO 4217 compliant

◆ checkMinorCurrency()

bool ore::data::checkMinorCurrency ( const string &  s)

Minor Currency Check.

check whether string is a minor currency

◆ convertMinorToMajorCurrency()

QuantLib::Real ore::data::convertMinorToMajorCurrency ( const std::string &  s,
QuantLib::Real  value 
)

Convert a value from a minor ccy to major.

.i.e 100 GBp to 1 GBP

◆ parseIborIndex()

boost::shared_ptr<IborIndex> ore::data::parseIborIndex ( const std::string &  strIndex,
std::string &  outTenor,
const QuantLib::Handle< QuantLib::YieldTermStructure > &  h = QuantLib::Handle< QuantLib::YieldTermStructure >(),
const boost::shared_ptr< Convention > &  c = nullptr 
)

Convert std::string to QuantLib::IborIndex and return the tenor string component of the index.

In some cases, after parsing the IborIndex, we would like to know the exact tenor string that was part of the strIndex that was parsed. If we ask the resulting index for its tenor via the method Period InterestRateIndex::tenor(), it can be difficult to deduce the original tenor string. A simple example of this is MXN-TIIE-28D where if you call tenor() and then to_string(), you get 4W which is different than the original 28D that is passed in.

Warning:
If the strIndex does not have a tenor component, as is the usual case for overnight indices, outTenor will be populated with the empty string.

◆ isInflationIndex()

std::pair<bool, boost::shared_ptr<QuantLib::ZeroInflationIndex> > ore::data::isInflationIndex ( const std::string &  indexName,
const boost::shared_ptr< Conventions > &  conventions = nullptr 
)

Returns true as the first element in the pair if the indexName is that of an InflationIndex. The second element in the pair is an instance of the inflation index. If indexName is not an inflation index, the first element in the pair is false and the second element is a nullptr.

If inflation indices have been set up via ZeroInflationIndex entries in the Conventions, the conventions should be passed here. If not, the default nullptr parameter will be sufficient.

◆ isGenericIndex()

bool ore::data::isGenericIndex ( const std::string &  indexName)

Return true if the indexName is that of an GenericIndex, otherwise false

◆ parseCommodityIndex()

boost::shared_ptr<QuantExt::CommodityIndex> ore::data::parseCommodityIndex ( const std::string &  name,
bool  hasPrefix = true,
const QuantLib::Calendar &  cal = QuantLib::NullCalendar(),
const QuantLib::Handle< QuantExt::PriceTermStructure > &  ts = QuantLib::Handle< QuantExt::PriceTermStructure >(),
const Conventions conventions = Conventions() 
)

Convert std::string to QuantExt::ComodityIndex

This function can be used to parse commodity spot indices or commodity future indices:

  • for spot indices, the name is of the form COMM-EXCHANGE:COMMODITY
  • for future indices, the name is of the form COMM-EXCHANGE:CONTRACT:YYYY-MM or COMM-EXCHANGE:CONTRACT:YYYY-MM-DD

◆ internalIndexName()

std::string ore::data::internalIndexName ( const std::string &  indexName)

In some cases, we allow multiple external ibor index names to represent the same QuantLib index. This function returns the unique index name that we use internally to represent the QuantLib index.

For example, we allow:

  • USD-FedFunds-1D and USD-FedFunds externally but we use USD-FedFunds internally
  • CAD-BA-tenor and CAD-CDOR-tenor externally but we use CAD-CDOR-tenor internally

◆ getMemoryUsageBytes()

unsigned long long ore::data::os::getMemoryUsageBytes ( )

Returns the current process memory usage in bytes Parts of code taken from: http://nadeausoftware.com/articles/2012/07/c_c_tip_how_get_process_resident_set_size_physical_memory_use

◆ tryParseReal()

bool ore::data::tryParseReal ( const string &  s,
QuantLib::Real &  result 
)

Attempt to convert text to Real.

Attempts to convert text to Real

Parameters
[in]sThe string we wish to convert to a Real
[out]resultThe result of the conversion if it is valid. Null<Real>() if conversion fails
Returns
True if the conversion was successful, False if not

◆ parseCalendar()

QuantLib::Calendar ore::data::parseCalendar ( const string &  s,
const string &  newName = "" 
)

Convert text to QuantLib::Calendar.

For a joint calendar, the separate calendar names should be comma-delimited.

◆ parseWeekday()

QuantLib::Weekday ore::data::parseWeekday ( const std::string &  s)

Convert text to QuantLib::Weekday

◆ parseMonth()

QuantLib::Month ore::data::parseMonth ( const std::string &  s)

Convert text to QuantLib::Month

◆ tryParse()

bool ore::data::tryParse ( const std::string &  str,
T &  obj,
std::function< T(std::string)>  parser 
)

Attempt to parse string str to obj of type T using parser

Parameters
[in]strThe string we wish to parse.
[out]objThe resulting object if the parsing was successful.
[in]parserThe function to use to attempt to parse str. This function may throw.
Returns
true if the parsing was successful and false if not.

◆ parseVolatilityQuoteType()

QuantLib::VolatilityType ore::data::parseVolatilityQuoteType ( const std::string &  s)

Convert text to QuantLib::VolatilityType

◆ parseCapFloorType()

QuantLib::CapFloor::Type ore::data::parseCapFloorType ( const std::string &  s)

Convert text to QuantLib::CapFloor::Type

◆ parseYoYInflationCapFloorType()

QuantLib::YoYInflationCapFloor::Type ore::data::parseYoYInflationCapFloorType ( const std::string &  s)

Convert text to QuantLib::YoYInflationCapFloor::Type

◆ parseCamAssetType()

QuantExt::CrossAssetModelTypes::AssetType ore::data::parseCamAssetType ( const std::string &  s)

◆ parseBoostAny()

std::pair<string, string> ore::data::parseBoostAny ( const boost::any &  anyType)

Convert boost::any to pair<string,string>, including the valueType and the value

◆ parseCdsOptionStrikeType()

QuantExt::CdsOption::StrikeType ore::data::parseCdsOptionStrikeType ( const std::string &  s)

Convert text to QuantExt::CdsOption::StrikeType

◆ parseAverageType()

QuantLib::Average::Type ore::data::parseAverageType ( const std::string &  s)

Convert text to QuantLib::Average::Type

◆ to_string() [1/3]

std::string ore::data::to_string ( const QuantLib::Date &  date)

Convert QuantLib::Date to std::string.

Returns date as a string in YYYY-MM-DD format, which matches QuantLib::io::iso_date() However that function can have issues with locale so we have a local snprintf() based version.

If date == Date() returns 1900-01-01 so the above format is preserved.

◆ to_string() [2/3]

std::string ore::data::to_string ( bool  aBool)

Convert bool to std::string.

Returns "true" for true and "false" for false

◆ to_string() [3/3]

std::string ore::data::to_string ( const T &  t)

Convert type to std::string.

Utility to give to_string() interface to classes and enums that have ostream<< operators defined.