Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
DerivativeTrsUnderlyingBuilder Struct Reference

#include <ored/portfolio/trsunderlyingbuilder.hpp>

+ Inheritance diagram for DerivativeTrsUnderlyingBuilder:
+ Collaboration diagram for DerivativeTrsUnderlyingBuilder:

Public Member Functions

void build (const std::string &parentId, const QuantLib::ext::shared_ptr< Trade > &underlying, const std::vector< Date > &valuationDates, const std::vector< Date > &paymentDates, const std::string &fundingCurrency, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, QuantLib::ext::shared_ptr< QuantLib::Index > &underlyingIndex, Real &underlyingMultiplier, std::map< std::string, double > &indexQuantities, std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndices, Real &initialPrice, std::string &assetCurrency, std::string &creditRiskCurrency, std::map< std::string, SimmCreditQualifierMapping > &creditQualifierMapping, Date &maturity, const std::function< QuantLib::ext::shared_ptr< QuantExt::FxIndex >(const QuantLib::ext::shared_ptr< Market > market, const std::string &configuration, const std::string &domestic, const std::string &foreign, std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndices)> &getFxIndex, const std::string &underlyingDerivativeId, RequiredFixings &fixings, std::vector< Leg > &returnLegs) const override
 
- Public Member Functions inherited from TrsUnderlyingBuilder
virtual ~TrsUnderlyingBuilder ()
 
virtual void build (const std::string &parentId, const QuantLib::ext::shared_ptr< Trade > &underlying, const std::vector< Date > &valuationDates, const std::vector< Date > &paymentDates, const std::string &fundingCurrency, const QuantLib::ext::shared_ptr< EngineFactory > &engineFactory, QuantLib::ext::shared_ptr< QuantLib::Index > &underlyingIndex, Real &underlyingMultiplier, std::map< std::string, double > &indexQuantities, std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndices, Real &initialPrice, std::string &assetCurrency, std::string &creditRiskCurrency, std::map< std::string, SimmCreditQualifierMapping > &creditQualifierMapping, Date &maturity, const std::function< QuantLib::ext::shared_ptr< QuantExt::FxIndex >(const QuantLib::ext::shared_ptr< Market > market, const std::string &configuration, const std::string &domestic, const std::string &foreign, std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndices)> &getFxIndex, const std::string &underlyingDerivativeId, RequiredFixings &fixings, std::vector< Leg > &returnLegs) const =0
 
virtual void updateUnderlying (const QuantLib::ext::shared_ptr< ReferenceDataManager > &refData, QuantLib::ext::shared_ptr< Trade > &underlying, const std::string &parentId) const
 

Detailed Description

Definition at line 155 of file trsunderlyingbuilder.hpp.

Member Function Documentation

◆ build()

void build ( const std::string &  parentId,
const QuantLib::ext::shared_ptr< Trade > &  underlying,
const std::vector< Date > &  valuationDates,
const std::vector< Date > &  paymentDates,
const std::string &  fundingCurrency,
const QuantLib::ext::shared_ptr< EngineFactory > &  engineFactory,
QuantLib::ext::shared_ptr< QuantLib::Index > &  underlyingIndex,
Real &  underlyingMultiplier,
std::map< std::string, double > &  indexQuantities,
std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &  fxIndices,
Real &  initialPrice,
std::string &  assetCurrency,
std::string &  creditRiskCurrency,
std::map< std::string, SimmCreditQualifierMapping > &  creditQualifierMapping,
Date &  maturity,
const std::function< QuantLib::ext::shared_ptr< QuantExt::FxIndex >(const QuantLib::ext::shared_ptr< Market > market, const std::string &configuration, const std::string &domestic, const std::string &foreign, std::map< std::string, QuantLib::ext::shared_ptr< QuantExt::FxIndex > > &fxIndices)> &  getFxIndex,
const std::string &  underlyingDerivativeId,
RequiredFixings fixings,
std::vector< Leg > &  returnLegs 
) const
overridevirtual

Implements TrsUnderlyingBuilder.

Definition at line 396 of file trsunderlyingbuilder.cpp.

408 {
409 assetCurrency = underlying->npvCurrency();
410 auto indexName = "GENERIC-" + underlyingDerivativeId;
411 IndexNameTranslator::instance().add(indexName, indexName);
412 underlyingIndex = QuantLib::ext::make_shared<QuantExt::GenericIndex>(indexName);
413 indexQuantities[indexName] = 1.0;
414 underlyingMultiplier = 1.0;
415 // FIXME same question as for single bond underlying: shouldn't we leave that empty and let TRS determine the
416 // maturity date based on valuation / funding dates?
417 maturity = underlying->maturity();
418
419 auto fxIndex = getFxIndex(engineFactory->market(), engineFactory->configuration(MarketContext::pricing),
420 assetCurrency, fundingCurrency, fxIndices);
421 returnLegs.push_back(QuantExt::TRSLeg(valuationDates, paymentDates, underlyingMultiplier, underlyingIndex, fxIndex)
422 .withInitialPrice(initialPrice));
423}
Time maturity
Definition: utilities.cpp:66