39#include <qle/termstructures/sabrparametricvolatility.hpp>
41#include <ql/cashflows/cpicoupon.hpp>
42#include <ql/compounding.hpp>
43#include <ql/currency.hpp>
44#include <ql/exercise.hpp>
45#include <ql/instruments/doublebarriertype.hpp>
46#include <ql/experimental/fx/deltavolquote.hpp>
47#include <ql/instruments/averagetype.hpp>
48#include <ql/instruments/barriertype.hpp>
49#include <ql/instruments/bond.hpp>
50#include <ql/instruments/capfloor.hpp>
51#include <ql/instruments/inflationcapfloor.hpp>
52#include <ql/instruments/overnightindexfuture.hpp>
53#include <ql/instruments/swaption.hpp>
54#include <ql/methods/finitedifferences/solvers/fdmbackwardsolver.hpp>
55#include <ql/methods/montecarlo/lsmbasissystem.hpp>
56#include <ql/position.hpp>
57#include <ql/termstructures/bootstraphelper.hpp>
58#include <ql/time/businessdayconvention.hpp>
59#include <ql/time/calendar.hpp>
60#include <ql/time/date.hpp>
61#include <ql/time/dategenerationrule.hpp>
62#include <ql/time/daycounter.hpp>
63#include <ql/time/period.hpp>
64#include <ql/types.hpp>
66#include <boost/algorithm/string/trim.hpp>
67#include <boost/tokenizer.hpp>
68#include <boost/variant.hpp>
102bool tryParseReal(
const string& s, QuantLib::Real& result);
174std::pair<QuantLib::Currency, QuantLib::Currency>
parseCurrencyPair(
const string& s,
const string& delimiters);
270boost::variant<QuantLib::Date, QuantLib::Period>
parseDateOrPeriod(
const string& s);
282QuantLib::LsmBasisSystem::PolynomialType
parsePolynomType(
const std::string& s);
288std::ostream&
operator<<(std::ostream& os, QuantLib::LsmBasisSystem::PolynomialType a);
310QuantLib::Month
parseMonth(
const std::string& s);
326 boost::char_separator<char> sep(
",");
327 boost::tokenizer<boost::char_separator<char>> tokens(s, sep);
328 for (
auto r : tokens) {
330 vec.push_back(parser(r));
335template <
class T> std::vector<T>
parseVectorOfValues(std::vector<std::string> str, std::function<T(
string)> parser) {
338 vec.push_back(parser(s));
343std::vector<string>
parseListOfValues(
string s,
const char escape =
'\\',
const char delim =
',',
344 const char quote =
'\"');
392QuantLib::DeltaVolQuote::AtmType
parseAtmType(
const std::string& s);
398QuantLib::DeltaVolQuote::DeltaType
parseDeltaType(
const std::string& s);
427template <
class T>
bool tryParse(
const std::string& str, T&
obj, std::function<T(
const std::string&)> parser) {
428 DLOG(
"tryParse: attempting to parse " << str);
432 TLOG(
"String " << str <<
" could not be parsed");
439 DLOG(
"tryParse: attempting to parse currency from " << str);
443 TLOG(
"String " << str <<
" could not be parsed");
481std::pair<string, string>
parseBoostAny(
const boost::any& anyType, Size precision = 8);
487std::ostream&
operator<<(std::ostream& os, QuantLib::RateAveraging::Type t);
502std::ostream&
operator<<(std::ostream& os, SobolBrownianGenerator::Ordering t);
505std::ostream&
operator<<(std::ostream& os, SobolRsg::DirectionIntegers t);
554string fxDominance(
const string& s1,
const string& s2);
612std::ostream&
operator<<(std::ostream& out, QuantExt::SabrParametricVolatility::ModelVariant m);
618std::ostream&
operator<<(std::ostream& os, QuantLib::Exercise::Type type);
CalculationPeriod
Indicate location of calculation period relative to the future expiry date.
PublicationRoll
Rule for determining when inflation swaps roll to observing latest inflation index release.
Type
Type of price segment being represented, i.e. type of instrument in the price segment.
Class to hold Underlyings.
Commodity curve configuration class.
SafeStack< ValueType > value
Currency and instrument specific conventions/defaults.
DateGeneration::Rule parseDateGenerationRule(const string &s)
Convert text to QuantLib::DateGeneration::Rule.
Calendar parseCalendar(const string &s)
Convert text to QuantLib::Calendar.
CdsOption::StrikeType parseCdsOptionStrikeType(const string &s)
Exercise::Type parseExerciseType(const std::string &s)
Convert text to QuantLib::Exercise::Type.
Currency parseMinorCurrency(const string &s)
Convert text to QuantLib::Currency for minor currencies e.g GBp -> GBPCurrency()
Month parseMonth(const string &s)
QuantExt::ConfigurableCurrency::Type parseCurrencyType(const string &s)
Convert text to QuantExt::ConfigurableCurrency::Type (Major, Minor, Metal, Crypto)
MporCashFlowMode parseMporCashFlowMode(const string &s)
Convert text to MporCashFlowMode.
YoYInflationCapFloor::Type parseYoYInflationCapFloorType(const string &s)
SequenceType parseSequenceType(const std::string &s)
Convert string to sequence type.
bool tryParseReal(const string &s, QuantLib::Real &result)
Attempt to convert text to Real.
VolatilityType parseVolatilityQuoteType(const string &s)
QuantLib::LsmBasisSystem::PolynomialType parsePolynomType(const std::string &s)
Convert text to QuantLib::LsmBasisSystem::PolynomialType.
DoubleBarrier::Type parseDoubleBarrierType(const std::string &s)
Convert std::string to QuantLib::DoubleBarrierType.
pair< string, string > parseBoostAny(const boost::any &anyType, Size precision)
bool tryParse(const std::string &str, T &obj, std::function< T(const std::string &)> parser)
Settlement::Method parseSettlementMethod(const std::string &s)
Convert text to QuantLib::Settlement::Method.
Currency parseCurrencyWithMinors(const string &s)
Convert text to QuantLib::Currency.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
QuantLib::Real convertMinorToMajorCurrency(const std::string &s, QuantLib::Real value)
Convert a value from a minor ccy to major.
boost::variant< QuantLib::Date, QuantLib::Period > parseDateOrPeriod(const string &s)
Convert text to QuantLib::Period or QuantLib::Date.
bool isCryptoCurrency(const string &code)
check for crypto currency */
bool isPreciousMetal(const string &code)
check for precious metal */
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
SabrParametricVolatility::ModelVariant parseSabrParametricVolatilityModelVariant(const std::string &s)
Parse SabrParametricVolatility::ModelVariant.
Position::Type parsePositionType(const std::string &s)
Convert text to QuantLib::Position::Type.
QuantLib::Pillar::Choice parsePillarChoice(const std::string &s)
Convert text to QuantLib::Pillar::Choice.
CapFloor::Type parseCapFloorType(const string &s)
BusinessDayConvention parseBusinessDayConvention(const string &s)
Convert text to QuantLib::BusinessDayConvention.
QuantLib::CPI::InterpolationType parseObservationInterpolation(const std::string &s)
Convert string to observation interpolation.
AssetClass parseAssetClass(const std::string &s)
Convert text to ore::data::AssetClass.
Period parsePeriod(const string &s)
Convert text to QuantLib::Period.
Frequency parseFrequency(const string &s)
Convert text to QuantLib::Frequency.
string fxDominance(const string &s1, const string &s2)
Convert FX pair to market standard dominance.
bool parseBool(const string &s)
Convert text to bool.
pair< Currency, Currency > parseCurrencyPair(const string &s, const string &delimiters)
Convert text to std::pair<QuantLib::Currency, QuantLib::Currency>
QuantLib::Bond::Price::Type parseBondPriceType(const string &s)
Convert text to QuantLib::Bond::Price::Type.
Compounding parseCompounding(const string &s)
Convert text to QuantLib::Compounding;.
SobolRsg::DirectionIntegers parseSobolRsgDirectionIntegers(const std::string &s)
Convert text to QuantLib::SobolRsg::DirectionIntegers.
QuantExt::BondIndex::PriceQuoteMethod parsePriceQuoteMethod(const std::string &s)
Weekday parseWeekday(const string &s)
PaymentLag parsePaymentLag(const string &s)
Convert text to PaymentLag.
Real parseRealOrNull(const string &s)
Convert text to Real, empty string to Null<Real>()
Barrier::Type parseBarrierType(const std::string &s)
Convert std::string to QuantLib::BarrierType.
bool isPseudoCurrency(const string &code)
check for pseudo currency = precious metal or crypto currency */
MomentType parseMomentType(const std::string &s)
Convert text to ore::data::MomentType.
DeltaVolQuote::AtmType parseAtmType(const std::string &s)
Convert text to QuantLib::DeltaVolQuote::AtmType.
Average::Type parseAverageType(const std::string &s)
QuantExt::McMultiLegBaseEngine::RegressorModel parseRegressorModel(const std::string &s)
Convert text to QuantExt::McMultiLegBaseEngine::RegressorModel.
Protection::Side parseProtectionSide(const std::string &s)
Convert text to QuantLib::Protection::Side.
Real parseReal(const string &s)
Convert text to Real.
SobolBrownianGenerator::Ordering parseSobolBrownianGeneratorOrdering(const std::string &s)
Convert text to QuantLib::SobolBrownianGenerator::Ordering.
QuantLib::Rounding::Type parseRoundingType(const std::string &s)
Convert text to QuantLib::Rounding.
bool checkCurrency(const string &code)
check for vaid currency code, including minors and pseudo currencies
QuantExt::CrossAssetModel::AssetType parseCamAssetType(const string &s)
FdmSchemeDesc parseFdmSchemeDesc(const std::string &s)
Convert string to fdm scheme desc.
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Settlement::Type parseSettlementType(const std::string &s)
Convert text to QuantLib::Settlement::Type.
DayCounter parseDayCounter(const string &s)
Convert text to QuantLib::DayCounter.
Option::Type parseOptionType(const std::string &s)
Convert text to QuantLib::Option::Type.
DeltaVolQuote::DeltaType parseDeltaType(const std::string &s)
Convert text to QuantLib::DeltaVolQuote::DeltaType.
Classes and functions for log message handling.
#define DLOG(text)
Logging Macro (Level = Debug)
#define TLOG(text)
Logging Macro (Level = Data)
CommodityQuantityFrequency
std::ostream & operator<<(std::ostream &out, EquityReturnType t)
std::vector< std::string > getCorrelationTokens(const std::string &name)
Helper function to get the two tokens in a correlation name Index2:Index1.
string normaliseFxIndex(const std::string &indexName)
Convert FX index name to market standard dominance.
bool isOnePeriod(const string &s)
return true if s represents a period of the form [0-9][D|W|M|Y] (i.e. 1Y6M would return false)
ADCP parseAveragingDataPeriod(const string &s)
Convert text to CommodityFutureConvention::AveragingData::CalculationPeriod.
std::vector< string > parseListOfValues(string s, const char escape, const char delim, const char quote)
CreditPortfolioSensitivityDecomposition parseCreditPortfolioSensitivityDecomposition(const std::string &s)
Convert text to CreditPortfolioSensitivitiyDecomposition.
FutureConvention::DateGenerationRule parseFutureDateGenerationRule(const std::string &s)
Convert text to FutureConvention::DateGeneration.
bool tryParseCurrency(const std::string &str, Currency &obj)
Extrapolation
Enumeration for holding various extrapolation settings.
CommodityQuantityFrequency parseCommodityQuantityFrequency(const string &s)
Convert text to QuantExt::CommodityQuantityFrequency.
std::vector< T > parseVectorOfValues(std::vector< std::string > str, std::function< T(string)> parser)
InflationSwapConvention::PublicationRoll parseInflationSwapPublicationRoll(const string &s)
Convert text to InflationSwapConvention::PublicationRoll.
CreditPortfolioSensitivityDecomposition
Enumeration CreditPortfolioSensitivityDecomposition.
AmortizationType parseAmortizationType(const std::string &s)
boost::variant< QuantLib::Period, QuantLib::Natural > PaymentLag
QuantLib::RateAveraging::Type parseOvernightIndexFutureNettingType(const std::string &s)
Convert text to QuantLib::RateAveraging::Type.
Extrapolation parseExtrapolation(const string &s)
Parse Extrapolation from string.
PriceSegment::Type parsePriceSegmentType(const string &s)
Convert text to PriceSegment::Type.
@ RelativeToPreviousNotional
@ RelativeToInitialNotional
Serializable Credit Default Swap.