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

Intrinsic engine for Ascots. More...

#include <qle/pricingengines/intrinsicascotengine.hpp>

+ Inheritance diagram for IntrinsicAscotEngine:
+ Collaboration diagram for IntrinsicAscotEngine:

Public Member Functions

 IntrinsicAscotEngine (const Handle< YieldTermStructure > &discountCurve)
 
void calculate () const override
 

Private Attributes

Handle< YieldTermStructure > discountCurve_
 

Detailed Description

Intrinsic engine for Ascots.

Definition at line 44 of file intrinsicascotengine.hpp.

Constructor & Destructor Documentation

◆ IntrinsicAscotEngine()

IntrinsicAscotEngine ( const Handle< YieldTermStructure > &  discountCurve)

Definition at line 28 of file intrinsicascotengine.cpp.

29 : discountCurve_(discountCurve) {
30 registerWith(discountCurve_);
31}
Handle< YieldTermStructure > discountCurve_

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 33 of file intrinsicascotengine.cpp.

33 {
34
35 QL_REQUIRE(arguments_.exercise->type() == Exercise::American, "not an American option");
36
37 ConvertibleBond2 bond = *arguments_.bond;
38 Real bondPrice = arguments_.bondQuantity * bond.NPV();
39
40 Date referenceDate = discountCurve_->referenceDate();
41 Date settlementDate = bond.calendar().advance(referenceDate, bond.settlementDays(), QuantLib::Days);
42
43 Real currentNotional = Null<Real>();
44 for (auto const& c : bond.cashflows()) {
45 if (auto coupon = QuantLib::ext::dynamic_pointer_cast<QuantLib::Coupon>(c)) {
46 currentNotional = coupon->nominal();
47 if (c->date() > referenceDate)
48 break;
49 }
50 }
51
52 QL_REQUIRE(currentNotional != Null<Real>(), "IntrinsicAscotEngine::calculate(): could not determine current "
53 "notional, underlying bond must have at least one coupon");
54
55 Leg upfrontLeg;
56 upfrontLeg.push_back(QuantLib::ext::make_shared<SimpleCashFlow>(currentNotional, settlementDate));
57 Real upfrontLegNpv = CashFlows::npv(upfrontLeg, **discountCurve_, false, referenceDate, referenceDate);
58
59 // includes redemption flows
60 Real assetLegNpv = CashFlows::npv(bond.cashflows(), **discountCurve_, false, referenceDate, referenceDate);
61
62 Real redemptionLegNpv = CashFlows::npv(bond.redemptions(), **discountCurve_, false, referenceDate, referenceDate);
63
64 // multiplied by bondNotional already
65 Real fundingLegNpv = CashFlows::npv(arguments_.fundingLeg, **discountCurve_, true, referenceDate, referenceDate);
66
67 Real strike = arguments_.bondQuantity * (upfrontLegNpv + assetLegNpv - redemptionLegNpv) - fundingLegNpv;
68
69 results_.value = PlainVanillaPayoff(arguments_.callPut, strike)(bondPrice);
70 results_.additionalResults["bondPrice"] = bondPrice;
71 results_.additionalResults["strike"] = strike;
72 results_.additionalResults["fundingLegNpv"] = fundingLegNpv;
73 results_.additionalResults["redemptionLegNpv"] = redemptionLegNpv * arguments_.bondQuantity;
74 results_.additionalResults["assetLegNpv"] = assetLegNpv * arguments_.bondQuantity;
75 results_.additionalResults["upfrontLegNpv"] = upfrontLegNpv * arguments_.bondQuantity;
76 results_.additionalResults["bondQuantity"] = arguments_.bondQuantity;
77}
const Instrument::results * results_
Definition: cdsoption.cpp:81
Swap::arguments * arguments_

Member Data Documentation

◆ discountCurve_

Handle<YieldTermStructure> discountCurve_
private

Definition at line 50 of file intrinsicascotengine.hpp.