File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -304,6 +304,24 @@ void CommoditySpreadOption::build(const boost::shared_ptr<ore::data::EngineFacto
304304 }
305305}
306306
307+ std::map<ore::data::AssetClass, std::set<std::string>>
308+ CommoditySpreadOption::underlyingIndices (const boost::shared_ptr<ReferenceDataManager>& referenceDataManager) const {
309+ std::map<ore::data::AssetClass, std::set<std::string>> result;
310+ auto legData = csoData_.legData ();
311+ for (const auto & leg : legData) {
312+ set<string> indices = leg.indices ();
313+ for (auto ind : indices) {
314+ boost::shared_ptr<Index> index = parseIndex (ind);
315+ // only handle commodity
316+ if (auto ci = boost::dynamic_pointer_cast<QuantExt::CommodityIndex>(index)) {
317+ result[ore::data::AssetClass::COM].insert (ci->name ());
318+ }
319+ }
320+ }
321+ return result;
322+ }
323+
324+
307325void CommoditySpreadOption::fromXML (XMLNode* node) {
308326 Trade::fromXML (node);
309327 XMLNode* csoNode = XMLUtils::getChildNode (node, " CommoditySpreadOptionData" );
@@ -356,6 +374,7 @@ XMLNode* CommoditySpreadOptionData::toXML(XMLDocument& doc) {
356374 return csoNode;
357375}
358376
377+
359378void CommoditySpreadOptionData::OptionStripData::fromXML (XMLNode* node) {
360379 XMLUtils::checkNode (node, " OptionStripPaymentDates" );
361380 XMLNode* optionStripScheduleNode = XMLUtils::getChildNode (node, " OptionStripDefinition" );
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ class CommoditySpreadOption : public ore::data::Trade {
9393
9494 // @}
9595
96+ // ! Add underlying Commodity names
97+ std::map<ore::data::AssetClass, std::set<std::string>>
98+ underlyingIndices (const boost::shared_ptr<ReferenceDataManager>& referenceDataManager = nullptr ) const override ;
99+
96100private:
97101 CommoditySpreadOptionData csoData_;
98102 std::vector<std::string> fxIndex_;
You can’t perform that action at this time.
0 commit comments