25 const Handle<Quote>& fx) {
26 components_.push_back(std::make_tuple(instrument, multiplier, fx));
27 registerWith(instrument);
38 instrument->alwaysForwardNotifications();
42 const Handle<Quote>& fx) {
43 add(instrument, -multiplier, fx);
48 if (!std::get<0>(*i)->isExpired())
56 additionalResults_.clear();
60 NPV_ += std::get<1>(*i) * std::get<2>(*i)->value() * std::get<0>(*i)->NPV();
61 for (
auto const& k : std::get<0>(*i)->additionalResults()) {
62 additionalResults_[k.first +
"_" + std::to_string(counter)] = k.second;
64 additionalResults_[
"__multiplier_" + std::to_string(counter)] = std::get<1>(*i);
65 additionalResults_[
"__fx_conversion_" + std::to_string(counter)] = std::get<2>(*i)->value();
71 std::get<0>(*i)->deepUpdate();
void performCalculations() const override
bool isExpired() const override
std::list< component >::const_iterator const_iterator
void deepUpdate() override
void add(const ext::shared_ptr< Instrument > &instrument, Real multiplier=1.0, const Handle< Quote > &fx=Handle< Quote >(QuantLib::ext::make_shared< SimpleQuote >(1.0)))
adds an instrument to the composite
std::list< component > components_
void subtract(const ext::shared_ptr< Instrument > &instrument, Real multiplier=1.0, const Handle< Quote > &fx=Handle< Quote >(QuantLib::ext::make_shared< SimpleQuote >(1.0)))
shorts an instrument from the composite