39 const QuantLib::ext::shared_ptr<Market> market = engineFactory->market();
46 QuantLib::ext::shared_ptr<FloatingRateCoupon> cpn;
47 if (
auto overnightIndex = QuantLib::ext::dynamic_pointer_cast<QuantLib::OvernightIndex>(*
index)) {
48 cpn = QuantLib::ext::make_shared<QuantExt::OvernightIndexedCoupon>(endDate,
amount_, startDate, endDate, overnightIndex,
50 cpn->setPricer(QuantLib::ext::make_shared<QuantExt::OvernightIndexedCouponPricer>());
52 bool useIndexedCoupon =
true;
53 cpn = QuantLib::ext::make_shared<QuantExt::IborFraCoupon>(startDate, endDate,
amount_, *
index,
strike_);
54 cpn->setPricer(QuantLib::ext::make_shared<BlackIborCouponPricer>(
55 Handle<OptionletVolatilityStructure>(), BlackIborCouponPricer::TimingAdjustment::Black76,
56 Handle<Quote>(ext::shared_ptr<Quote>(
new SimpleQuote(1.0))), useIndexedCoupon));
58 legs_.push_back({cpn});
62 legPayers_ = vector<bool>(1, positionType == Position::Type::Short);
69 QuantLib::ext::shared_ptr<EngineBuilder> builder = engineFactory->builder(
"Swap");
70 QuantLib::ext::shared_ptr<SwapEngineBuilderBase> swapBuilder = QuantLib::ext::dynamic_pointer_cast<SwapEngineBuilderBase>(builder);
71 QL_REQUIRE(swapBuilder,
"No Builder found for Swap " <<
id());
72 swap->setPricingEngine(swapBuilder->engine(npvCcy, std::string(), std::string()));
Engine builder for Swaps.
const string & index() const
virtual void fromXML(XMLNode *node) override
virtual XMLNode * toXML(XMLDocument &doc) const override
void build(const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory) override
Build QuantLib/QuantExt instrument, link pricing engine.
std::vector< bool > legPayers_
std::vector< string > legCurrencies_
std::vector< QuantLib::Leg > legs_
virtual void fromXML(XMLNode *node) override
void setSensitivityTemplate(const EngineBuilder &builder)
virtual XMLNode * toXML(XMLDocument &doc) const override
QuantLib::ext::shared_ptr< InstrumentWrapper > instrument_
std::map< std::string, boost::any > additionalData_
Vanilla Instrument Wrapper.
Small XML Document wrapper class.
XMLNode * allocNode(const string &nodeName)
util functions that wrap rapidxml
static Real getChildValueAsDouble(XMLNode *node, const string &name, bool mandatory=false, double defaultValue=0.0)
static string getChildValue(XMLNode *node, const string &name, bool mandatory=false, const string &defaultValue=string())
static XMLNode * getChildNode(XMLNode *n, const string &name="")
static XMLNode * addChild(XMLDocument &doc, XMLNode *n, const string &name)
static void appendNode(XMLNode *parent, XMLNode *child)
ForwardRateAgreement data model and serialization.
Date parseDate(const string &s)
Convert std::string to QuantLib::Date.
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Position::Type parsePositionType(const std::string &s)
Convert text to QuantLib::Position::Type.
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.