|
QuantLib: a free/open-source library for quantitative finance
Reference manual - version 1.41
|
#include <ql/termstructures/multicurve.hpp>
Public Member Functions | |
| MultiCurve (Real accuracy) | |
| MultiCurve (const ext::shared_ptr< OptimizationMethod > &optimizer=nullptr, const ext::shared_ptr< EndCriteria > &endCriteria=nullptr) | |
| Handle< YieldTermStructure > | addBootstrappedCurve (RelinkableHandle< YieldTermStructure > &internalHandle, ext::shared_ptr< YieldTermStructure > &&curve) |
| Handle< YieldTermStructure > | addNonBootstrappedCurve (RelinkableHandle< YieldTermStructure > &internalHandle, ext::shared_ptr< YieldTermStructure > &&curve) |
| Public Member Functions inherited from Observer | |
| Observer (const Observer &) | |
| Observer & | operator= (const Observer &) |
| std::pair< iterator, bool > | registerWith (const ext::shared_ptr< Observable > &) |
| void | registerWithObservables (const ext::shared_ptr< Observer > &) |
| Size | unregisterWith (const ext::shared_ptr< Observable > &) |
| void | unregisterWithAll () |
| virtual void | deepUpdate () |
Additional Inherited Members | |
| Public Types inherited from Observer | |
| typedef set_type::iterator | iterator |
MultiCurve builds a set of curves that form a dependency cycle. MultiCurve builds such a cycle of curves by using an optimizer specified by one of its constructors. The steps to set up the member curves of the cycle is as follows:
Construct each member curve as a shared pointer, e.g. by calling
a) make_shared<PiecewiseYieldCurve<...>> b) make_shared<ZeroSpreadedTermStructure>
Rate helpers in a) or the base curve in b) underlying the spreaded curve should use the internal handles from 1. Curves using a bootstrapper as in a) must use a compatible boostrap class like GlobalBootstrap.
Construct a MultiCurve instance. This must be a shared pointer.
Add the cycle members to the MultiCurve instance using addBootstrappedCurve() for curves using a bootstrapper, as e.g. in a), resp. addNonBootstrappedCurve() for all other curves, as e.g. in b).
Both methods take the internal handle of the curve from 1. and the shared pointer from 2 as an argument. The latter has to be moved into the function and can not be used afterwards.
Both functions return an external handle to the curve which should be used to reference the curve for all other purposes than the internal handle in 2.
The internal handle is linked to the relevant curve, but the ownership and observability is removed to avoid cycles of shared pointers and notification cyclces.
The external handles are constructed with ownership information shared with the MultiCurve instance, which ensures that all member curves are kept alive until none of the curves and the MultiCurve instance itself is referenced by any alive object.
See the piecewise yield curve unit tests for examples.