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

helper class for implied vanilla bond spread calculation More...

#include <qle/instruments/impliedbondspread.hpp>

+ Collaboration diagram for ImpliedBondSpreadHelper:

Static Public Member Functions

static QuantLib::Real calculate (const QuantLib::ext::shared_ptr< QuantLib::Bond > &bond, const QuantLib::ext::shared_ptr< QuantLib::PricingEngine > &engine, const QuantLib::ext::shared_ptr< QuantLib::SimpleQuote > &spreadQuote, QuantLib::Real targetValue, bool isCleanPrice, QuantLib::Real accuracy, QuantLib::Natural maxEvaluations, QuantLib::Real minSpread, QuantLib::Real maxSpread)
 

Detailed Description

helper class for implied vanilla bond spread calculation

The passed engine must be linked to the passed quote

Note
this function is meant for developers of bond classes so that they can compute a fair credit spread, or infer spread from quoted bond price.

Definition at line 42 of file impliedbondspread.hpp.

Member Function Documentation

◆ calculate()

Real calculate ( const QuantLib::ext::shared_ptr< QuantLib::Bond > &  bond,
const QuantLib::ext::shared_ptr< QuantLib::PricingEngine > &  engine,
const QuantLib::ext::shared_ptr< QuantLib::SimpleQuote > &  spreadQuote,
QuantLib::Real  targetValue,
bool  isCleanPrice,
QuantLib::Real  accuracy,
QuantLib::Natural  maxEvaluations,
QuantLib::Real  minSpread,
QuantLib::Real  maxSpread 
)
static

Definition at line 55 of file impliedbondspread.cpp.

59 {
60
61 Bond clonedBond = *bond;
62 clonedBond.setPricingEngine(engine);
63 clonedBond.recalculate();
64 spreadQuote->setValue(0.005);
65
66 PriceError f(clonedBond, *spreadQuote, targetValue, isCleanPrice);
67 Brent solver;
68 solver.setMaxEvaluations(maxEvaluations);
69 Real guess = (minSpread + maxSpread) / 2.0;
70 Real result = solver.solve(f, accuracy, guess, minSpread, maxSpread);
71 return result;
72}
+ Here is the caller graph for this function: