Skip to content

Commit d561f05

Browse files
author
jenkins
committed
git subrepo pull (merge) ore
subrepo: subdir: "ore" merged: "b3d23547fc" upstream: origin: "git@gitlab.acadiasoft.net:qs/ore.git" branch: "master" commit: "076c4d584b" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "110b9eb"
2 parents 0c1f68c + 076c4d5 commit d561f05

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

OREData/ored/portfolio/trs.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <boost/assign/list_of.hpp>
3333
#include <boost/bimap.hpp>
3434
#include <boost/optional.hpp>
35+
#include <boost/range/adaptor/map.hpp>
3536

3637
namespace ore {
3738
namespace data {
@@ -653,6 +654,23 @@ void TRS::build(const boost::shared_ptr<EngineFactory>& engineFactory) {
653654
wrapper->setPricingEngine(boost::make_shared<TRSWrapperAccrualEngine>());
654655
instrument_ = boost::make_shared<VanillaInstrument>(wrapper);
655656

657+
// if the first valuation date is > today, we potentially need fixings for fx conversion as of "today"
658+
659+
if (Date today = Settings::instance().evaluationDate(); !valuationDates.empty() && valuationDates.front() > today) {
660+
std::set<boost::shared_ptr<QuantExt::FxIndex>> tmp;
661+
auto fxIndicesVal = fxIndices | boost::adaptors::map_values;
662+
tmp.insert(fxIndicesVal.begin(), fxIndicesVal.end());
663+
tmp.insert(fxIndexAsset.begin(), fxIndexAsset.end());
664+
tmp.insert(fxIndexReturn);
665+
tmp.insert(fxIndexAdditionalCashflows);
666+
for (auto const& fx : tmp) {
667+
if (fx != nullptr) {
668+
requiredFixings_.addFixingDate(fx->fixingCalendar().adjust(today, Preceding),
669+
IndexNameTranslator::instance().oreName(fx->name()));
670+
}
671+
}
672+
}
673+
656674
// set trade member variables (leave legs empty for the time being, we just have the funding leg really)
657675

658676
npvCurrency_ = fundingCurrency;

0 commit comments

Comments
 (0)