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

#include <qle/pricingengines/oiccbasisswapengine.hpp>

+ Inheritance diagram for OvernightIndexedCrossCcyBasisSwapEngine:
+ Collaboration diagram for OvernightIndexedCrossCcyBasisSwapEngine:

Public Member Functions

 OvernightIndexedCrossCcyBasisSwapEngine (const Handle< YieldTermStructure > &ts1, const Currency &ccy1, const Handle< YieldTermStructure > &ts2, const Currency &ccy2, const Handle< Quote > &fx)
 
void calculate () const override
 
Handle< YieldTermStructure > ts1 ()
 
Handle< YieldTermStructure > ts2 ()
 
Currency ccy1 ()
 
Currency ccy2 ()
 
Handle< Quote > fx ()
 

Private Attributes

Handle< YieldTermStructure > ts1_
 
Currency ccy1_
 
Handle< YieldTermStructure > ts2_
 
Currency ccy2_
 
Handle< Quote > fx_
 

Detailed Description

Overnight Indexed Cross Currency Basis Swap Engine

Definition at line 35 of file oiccbasisswapengine.hpp.

Constructor & Destructor Documentation

◆ OvernightIndexedCrossCcyBasisSwapEngine()

OvernightIndexedCrossCcyBasisSwapEngine ( const Handle< YieldTermStructure > &  ts1,
const Currency &  ccy1,
const Handle< YieldTermStructure > &  ts2,
const Currency &  ccy2,
const Handle< Quote > &  fx 
)

Member Function Documentation

◆ calculate()

void calculate ( ) const
override

Definition at line 43 of file oiccbasisswapengine.cpp.

43 {
44 results_.value = 0.0;
45 results_.errorEstimate = Null<Real>();
46
47 QL_REQUIRE(!fx_.empty(), "fx handle not set");
48 QL_REQUIRE(!ts1_.empty(), "ts1 handle not set");
49 QL_REQUIRE(!ts2_.empty(), "ts2 handle not set");
50
51 QL_REQUIRE(ts1_->referenceDate() == ts2_->referenceDate(), "reference dates do not match");
52
53 Date npvDate = Settings::instance().evaluationDate();
54
55 results_.valuationDate = npvDate;
56
57 results_.legNPV.resize(arguments_.legs.size());
58 results_.legBPS.resize(arguments_.legs.size());
59
60 bool includeRefDateFlows = Settings::instance().includeReferenceDateEvents();
61
62 for (Size i = 0; i < arguments_.legs.size(); ++i) {
63 try {
64 Handle<YieldTermStructure> yts;
65 Real fx;
66 if (arguments_.currency[i] == ccy1_) {
67 yts = ts1_;
68 fx = 1.0;
69 } else {
70 yts = ts2_;
71 fx = fx_->value();
72 }
73 results_.legNPV[i] = fx * arguments_.payer[i] *
74 CashFlows::npv(arguments_.legs[i], **yts, includeRefDateFlows, npvDate, npvDate);
75 results_.legBPS[i] = fx * arguments_.payer[i] *
76 CashFlows::bps(arguments_.legs[i], **yts, includeRefDateFlows, npvDate, npvDate);
77 } catch (std::exception& e) {
78 QL_FAIL(io::ordinal(i + 1) << " leg: " << e.what());
79 }
80 results_.value += results_.legNPV[i];
81 }
82
83 static Spread basisPoint = 1.0e-4;
84 results_.fairPayLegSpread = arguments_.paySpread - results_.value / (results_.legBPS[0] / basisPoint);
85 results_.fairRecLegSpread = arguments_.recSpread - results_.value / (results_.legBPS[1] / basisPoint);
86}
const Instrument::results * results_
Definition: cdsoption.cpp:81
Swap::arguments * arguments_
+ Here is the call graph for this function:

◆ ts1()

Handle< YieldTermStructure > ts1 ( )

Definition at line 43 of file oiccbasisswapengine.hpp.

43{ return ts1_; }

◆ ts2()

Handle< YieldTermStructure > ts2 ( )

Definition at line 44 of file oiccbasisswapengine.hpp.

44{ return ts2_; }

◆ ccy1()

Currency ccy1 ( )

Definition at line 45 of file oiccbasisswapengine.hpp.

45{ return ccy1_; }

◆ ccy2()

Currency ccy2 ( )

Definition at line 46 of file oiccbasisswapengine.hpp.

46{ return ccy2_; }

◆ fx()

Handle< Quote > fx ( )

Definition at line 47 of file oiccbasisswapengine.hpp.

47{ return fx_; }
+ Here is the caller graph for this function:

Member Data Documentation

◆ ts1_

Handle<YieldTermStructure> ts1_
private

Definition at line 50 of file oiccbasisswapengine.hpp.

◆ ccy1_

Currency ccy1_
private

Definition at line 51 of file oiccbasisswapengine.hpp.

◆ ts2_

Handle<YieldTermStructure> ts2_
private

Definition at line 52 of file oiccbasisswapengine.hpp.

◆ ccy2_

Currency ccy2_
private

Definition at line 53 of file oiccbasisswapengine.hpp.

◆ fx_

Handle<Quote> fx_
private

Definition at line 54 of file oiccbasisswapengine.hpp.