22#include <boost/make_shared.hpp>
28#include <ql/errors.hpp>
29#include <ql/exercise.hpp>
30#include <ql/instruments/barrieroption.hpp>
31#include <ql/instruments/barriertype.hpp>
32#include <ql/instruments/compositeinstrument.hpp>
33#include <ql/instruments/vanillaoption.hpp>
42 QL_REQUIRE(
barrier().levels().
size() == 2,
"Invalid number of barrier levels. Must have two.");
43 QL_REQUIRE(
barrier().style().empty() ||
barrier().style() ==
"American",
"Only american barrier style suppported");
46QuantLib::ext::shared_ptr<QuantLib::PricingEngine>
48 const QuantLib::Date& expiryDate,
const QuantLib::Date& paymentDate) {
50 if (paymentDate > expiryDate) {
51 QuantLib::ext::shared_ptr<EngineBuilder> builder = ef->builder(
"FxOptionEuropeanCS");
52 QL_REQUIRE(builder,
"No builder found for FxOptionEuropeanCS");
54 QuantLib::ext::shared_ptr<FxEuropeanCSOptionEngineBuilder> fxOptBuilder =
55 QuantLib::ext::dynamic_pointer_cast<FxEuropeanCSOptionEngineBuilder>(builder);
56 QL_REQUIRE(fxOptBuilder,
"No FxEuropeanOptionEngineBuilder found");
62 QuantLib::ext::shared_ptr<EngineBuilder> builder = ef->builder(
"FxOption");
63 QL_REQUIRE(builder,
"No builder found for FxOption");
65 QuantLib::ext::shared_ptr<FxEuropeanOptionEngineBuilder> fxOptBuilder =
66 QuantLib::ext::dynamic_pointer_cast<FxEuropeanOptionEngineBuilder>(builder);
67 QL_REQUIRE(fxOptBuilder,
"No FxEuropeanOptionEngineBuilder found");
73QuantLib::ext::shared_ptr<QuantLib::PricingEngine>
75 const QuantLib::Date& expiryDate,
const QuantLib::Date& paymentDate) {
77 QuantLib::ext::shared_ptr<EngineBuilder> builder = ef->builder(
tradeType_);
78 QL_REQUIRE(builder,
"No builder found for " <<
tradeType_);
80 QuantLib::ext::shared_ptr<FxDoubleBarrierOptionEngineBuilder> fxBarrierOptBuilder =
81 QuantLib::ext::dynamic_pointer_cast<FxDoubleBarrierOptionEngineBuilder>(builder);
82 QL_REQUIRE(fxBarrierOptBuilder,
"No fxBarrierOptBuilder found");
Wrapper for option instruments, tracks whether option has been exercised or not.
Engine builder for FX Options.
const BarrierData & barrier() const
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > barrierPricingEngine(const QuantLib::ext::shared_ptr< EngineFactory > &ef, const QuantLib::Date &expiryDate, const QuantLib::Date &paymentDate=QuantLib::Date()) override
QuantLib::ext::shared_ptr< QuantLib::PricingEngine > vanillaPricingEngine(const QuantLib::ext::shared_ptr< EngineFactory > &ef, const QuantLib::Date &expiryDate, const QuantLib::Date &paymentDate=QuantLib::Date()) override
create the pricing engines
void checkBarriers() override
check validity of barriers
std::string soldCurrency_
std::string boughtCurrency_
void setSensitivityTemplate(const EngineBuilder &builder)
FX Double Barrier Option data model and serialization.
FX Option data model and serialization.
Currency parseCurrency(const string &s)
Convert text to QuantLib::Currency.
Map text representations to QuantLib/QuantExt types.
Classes and functions for log message handling.
Size size(const ValueType &v)
Serializable Credit Default Swap.
Map text representations to QuantLib/QuantExt types.