Accrual Bond Repo Engine.
More...
#include <qle/pricingengines/accrualbondrepoengine.hpp>
Accrual Bond Repo Engine.
Definition at line 26 of file accrualbondrepoengine.hpp.
◆ AccrualBondRepoEngine()
◆ calculate()
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);
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 }
41 Real securityLegAccrual = -multiplier *
arguments_.security->accruedAmount(today) / 100.0 *
43 results_.additionalResults[
"CashLegNominal"] = cashLegNominal;
44 results_.additionalResults[
"CashLegAccrual"] = cashLegAccrual;
45 results_.additionalResults[
"CashLegNPV"] = cashLegNpv;
47 results_.additionalResults[
"SecurityLegCleanNPV"] = securityLegNpv - securityLegAccrual;
48 results_.additionalResults[
"SecurityLegAccrual"] = securityLegAccrual;
49 results_.additionalResults[
"SecurityLegNPV"] = securityLegNpv;
51}
const Instrument::results * results_
Swap::arguments * arguments_
◆ includeSecurityLeg_
const bool includeSecurityLeg_ |
|
private |