23#include <boost/make_shared.hpp>
32 return GFunctionFactory::Standard;
33 else if (s ==
"ExactYield")
34 return GFunctionFactory::ExactYield;
35 else if (s ==
"ParallelShifts")
36 return GFunctionFactory::ParallelShifts;
37 else if (s ==
"NonParallelShifts")
38 return GFunctionFactory::NonParallelShifts;
40 QL_FAIL(
"unknown string for YieldCurveModel");
45 std::string ccyCode = key;
46 QuantLib::ext::shared_ptr<IborIndex> index;
48 ccyCode = index->currency().code();
51 GFunctionFactory::YieldCurveModel ycm =
ycmFromString(ycmstr);
53 Handle<Quote> revQuote(QuantLib::ext::shared_ptr<Quote>(
new SimpleQuote(rev)));
56 QuantLib::ext::shared_ptr<FloatingRateCouponPricer> pricer = QuantLib::ext::make_shared<AnalyticHaganPricer>(vol, ycm, revQuote);
64 std::string ccyCode = key;
65 QuantLib::ext::shared_ptr<IborIndex> index;
67 ccyCode = index->currency().code();
70 GFunctionFactory::YieldCurveModel ycm =
ycmFromString(ycmstr);
75 Handle<Quote> revQuote(QuantLib::ext::shared_ptr<Quote>(
new SimpleQuote(rev)));
78 QuantLib::ext::shared_ptr<FloatingRateCouponPricer> pricer =
79 QuantLib::ext::make_shared<NumericHaganPricer>(vol, ycm, revQuote, llim, ulim, prec);
87 std::string ccyCode = key;
88 QuantLib::ext::shared_ptr<IborIndex> index;
90 ccyCode = index->currency().code();
94 Handle<Quote> revQuote(QuantLib::ext::shared_ptr<Quote>(
new SimpleQuote(rev)));
98 string lowerBoundStr =
99 (vol->volatilityType() == ShiftedLognormal) ?
"LowerRateBoundLogNormal" :
"LowerRateBoundNormal";
100 string upperBoundStr =
101 (vol->volatilityType() == ShiftedLognormal) ?
"UpperRateBoundLogNormal" :
"UpperRateBoundNormal";
103 LinearTsrPricer::Settings settings;
104 if (policy ==
"RateBound") {
107 settings.withRateBound(lower, upper);
108 }
else if (policy ==
"VegaRatio") {
112 settings.withVegaRatio(vega, lower, upper);
113 }
else if (policy ==
"PriceThreshold") {
117 settings.withPriceThreshold(threshold, lower, upper);
118 }
else if (policy ==
"BsStdDev") {
122 settings.withPriceThreshold(stddevs, lower, upper);
124 QL_FAIL(
"unknown string for policy parameter");
126 QuantLib::ext::shared_ptr<FloatingRateCouponPricer> pricer =
127 QuantLib::ext::make_shared<LinearTsrPricer>(vol, revQuote, yts, settings);
virtual QuantLib::ext::shared_ptr< FloatingRateCouponPricer > engineImpl(const string &key) override
QuantLib::ext::shared_ptr< Market > market_
std::string engineParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)
virtual QuantLib::ext::shared_ptr< FloatingRateCouponPricer > engineImpl(const string &key) override
virtual QuantLib::ext::shared_ptr< FloatingRateCouponPricer > engineImpl(const string &key) override
builder that returns an engine to price capped floored ibor legs
bool tryParseIborIndex(const string &s, QuantLib::ext::shared_ptr< IborIndex > &index)
Try to convert std::string to QuantLib::IborIndex.
Real parseReal(const string &s)
Convert text to Real.
Classes and functions for log message handling.
GFunctionFactory::YieldCurveModel ycmFromString(const string &s)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.