Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
AccrualBondRepoEngine Class Reference

Accrual Bond Repo Engine. More...

#include <qle/pricingengines/accrualbondrepoengine.hpp>

+ Inheritance diagram for AccrualBondRepoEngine:
+ Collaboration diagram for AccrualBondRepoEngine:

Public Member Functions

 AccrualBondRepoEngine (const bool includeSecurityLeg=true)
 
void calculate () const override
 

Private Attributes

const bool includeSecurityLeg_
 

Detailed Description

Accrual Bond Repo Engine.

Definition at line 26 of file accrualbondrepoengine.hpp.

Constructor & Destructor Documentation

◆ AccrualBondRepoEngine()

AccrualBondRepoEngine ( const bool  includeSecurityLeg = true)
explicit

Definition at line 27 of file accrualbondrepoengine.cpp.

27: includeSecurityLeg_(includeSecurityLeg) {}

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 29 of file accrualbondrepoengine.cpp.

29 {
30 Date today = Settings::instance().evaluationDate();
31 Real multiplier = arguments_.cashLegPays ? -1.0 : 1.0;
32 Real cashLegAccrual = 0.0, cashLegNominal = 0.0, cashLegNpv = 0.0;
33 auto cf = CashFlows::nextCashFlow(arguments_.cashLeg, false);
34 if (cf != arguments_.cashLeg.end()) {
35 auto cpn = QuantLib::ext::dynamic_pointer_cast<Coupon>(*cf);
36 cashLegNominal = multiplier * cpn->nominal();
37 cashLegAccrual = multiplier * CashFlows::accruedAmount(arguments_.cashLeg, false);
38 cashLegNpv = cashLegNominal + cashLegAccrual;
39 }
40 Real securityLegNpv = -multiplier * arguments_.security->NPV() * arguments_.securityMultiplier;
41 Real securityLegAccrual = -multiplier * arguments_.security->accruedAmount(today) / 100.0 *
42 arguments_.security->notional(today) * arguments_.securityMultiplier;
43 results_.additionalResults["CashLegNominal"] = cashLegNominal;
44 results_.additionalResults["CashLegAccrual"] = cashLegAccrual;
45 results_.additionalResults["CashLegNPV"] = cashLegNpv;
46 results_.additionalResults["SecurityQuantity"] = arguments_.securityMultiplier;
47 results_.additionalResults["SecurityLegCleanNPV"] = securityLegNpv - securityLegAccrual;
48 results_.additionalResults["SecurityLegAccrual"] = securityLegAccrual;
49 results_.additionalResults["SecurityLegNPV"] = securityLegNpv;
50 results_.value = cashLegNpv + (includeSecurityLeg_ ? securityLegNpv : 0.0);
51}
const Instrument::results * results_
Definition: cdsoption.cpp:81
Swap::arguments * arguments_

Member Data Documentation

◆ includeSecurityLeg_

const bool includeSecurityLeg_
private

Definition at line 33 of file accrualbondrepoengine.hpp.