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

FX Black Scholes constant parametrization. More...

#include <qle/models/fxbspiecewiseconstantparametrization.hpp>

+ Inheritance diagram for FxBsPiecewiseConstantParametrization:
+ Collaboration diagram for FxBsPiecewiseConstantParametrization:

Public Member Functions

 FxBsPiecewiseConstantParametrization (const Currency &currency, const Handle< Quote > &fxSpotToday, const Array &times, const Array &sigma, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &sigmaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
 FxBsPiecewiseConstantParametrization (const Currency &currency, const Handle< Quote > &fxSpotToday, const std::vector< Date > &dates, const Array &sigma, const Handle< YieldTermStructure > &domesticTermStructure, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &sigmaConstraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
Real variance (const Time t) const override
 
Real sigma (const Time t) const override
 
const Array & parameterTimes (const Size) const override
 
const QuantLib::ext::shared_ptr< Parameter > parameter (const Size) const override
 
void update () const override
 
- Public Member Functions inherited from FxBsParametrization
 FxBsParametrization (const Currency &foreignCurrency, const Handle< Quote > &fxSpotToday)
 
virtual Real variance (const Time t) const =0
 
virtual Real sigma (const Time t) const
 
virtual Real stdDeviation (const Time t) const
 
const Handle< Quote > fxSpotToday () const
 
Size numberOfParameters () const override
 
- Public Member Functions inherited from Parametrization
 Parametrization (const Currency &currency, const std::string &name="")
 
virtual ~Parametrization ()
 
virtual const Currency & currency () const
 
virtual const Array & parameterTimes (const Size) const
 
virtual Size numberOfParameters () const
 
virtual Array parameterValues (const Size) const
 
virtual const QuantLib::ext::shared_ptr< Parameter > parameter (const Size) const
 
virtual void update () const
 
const std::string & name () const
 
virtual Real direct (const Size, const Real x) const
 
virtual Real inverse (const Size, const Real y) const
 

Protected Member Functions

Real direct (const Size i, const Real x) const override
 
Real inverse (const Size i, const Real y) const override
 
- Protected Member Functions inherited from Parametrization
Time tr (const Time t) const
 
Time tl (const Time t) const
 
Time tr2 (const Time t) const
 
Time tm2 (const Time t) const
 
Time tl2 (const Time t) const
 

Private Member Functions

void initialize (const Array &sigma)
 
- Private Member Functions inherited from PiecewiseConstantHelper1
 PiecewiseConstantHelper1 (const Array &t, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
 PiecewiseConstantHelper1 (const std::vector< Date > &dates, const Handle< YieldTermStructure > &yts, const QuantLib::ext::shared_ptr< QuantLib::Constraint > &constraint=QuantLib::ext::make_shared< QuantLib::NoConstraint >())
 
const Array & t () const
 
const QuantLib::ext::shared_ptr< Parameter > p () const
 
void update () const
 
Real y (const Time t) const
 
Real int_y_sqr (const Time t) const
 int_0^t y^2(s) ds More...
 
Real direct (const Real x) const
 
Real inverse (const Real y) const
 

Additional Inherited Members

- Protected Attributes inherited from Parametrization
const Real h_
 
const Real h2_
 
- Private Attributes inherited from PiecewiseConstantHelper1
const Array t_
 
const QuantLib::ext::shared_ptr< PseudoParametery_
 

Detailed Description

FX Black Scholes constant parametrization.

FX Black Scholes parametrization with piecewise constant volatility

Definition at line 36 of file fxbspiecewiseconstantparametrization.hpp.

Constructor & Destructor Documentation

◆ FxBsPiecewiseConstantParametrization() [1/2]

FxBsPiecewiseConstantParametrization ( const Currency &  currency,
const Handle< Quote > &  fxSpotToday,
const Array &  times,
const Array &  sigma,
const QuantLib::ext::shared_ptr< QuantLib::Constraint > &  sigmaConstraint = QuantLib::ext::make_shared< QuantLib::NoConstraint >() 
)

The currency refers to the foreign currency, the spot is as of today (i.e. the discounted spot)

◆ FxBsPiecewiseConstantParametrization() [2/2]

FxBsPiecewiseConstantParametrization ( const Currency &  currency,
const Handle< Quote > &  fxSpotToday,
const std::vector< Date > &  dates,
const Array &  sigma,
const Handle< YieldTermStructure > &  domesticTermStructure,
const QuantLib::ext::shared_ptr< QuantLib::Constraint > &  sigmaConstraint = QuantLib::ext::make_shared< QuantLib::NoConstraint >() 
)

The term structure is needed in addition because it it's day counter and reference date is needed to convert dates to times. It should be the term structure of the domestic IR component in the cross asset model, since this is defining the model's date-time conversion in more general terms.

Member Function Documentation

◆ variance()

Real variance ( const Time  t) const
overridevirtual

must satisfy variance(0) = 0.0, variance'(t) >= 0

Implements FxBsParametrization.

Definition at line 78 of file fxbspiecewiseconstantparametrization.hpp.

78 {
80}
Real int_y_sqr(const Time t) const
int_0^t y^2(s) ds
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sigma()

Real sigma ( const Time  t) const
overridevirtual

is supposed to be positive

Reimplemented from FxBsParametrization.

Definition at line 82 of file fxbspiecewiseconstantparametrization.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parameterTimes()

const Array & parameterTimes ( const Size  Size) const
overridevirtual

the times associated to parameter i

Reimplemented from Parametrization.

Definition at line 84 of file fxbspiecewiseconstantparametrization.hpp.

84 {
85 QL_REQUIRE(i == 0, "parameter " << i << " does not exist, only have 0");
87}

◆ parameter()

const QuantLib::ext::shared_ptr< Parameter > parameter ( const Size  Size) const
overridevirtual

the parameter storing the raw parameter values

Reimplemented from Parametrization.

Definition at line 89 of file fxbspiecewiseconstantparametrization.hpp.

89 {
90 QL_REQUIRE(i == 0, "parameter " << i << " does not exist, only have 0");
92}
const QuantLib::ext::shared_ptr< PseudoParameter > y_

◆ update()

void update ( ) const
overridevirtual

this method should be called when input parameters linked via references or pointers change in order to ensure consistent results

Reimplemented from Parametrization.

Definition at line 94 of file fxbspiecewiseconstantparametrization.hpp.

+ Here is the call graph for this function:

◆ direct()

Real direct ( const Size  Size,
const Real  x 
) const
overrideprotectedvirtual

transformations between raw and actual parameters

Reimplemented from Parametrization.

Definition at line 70 of file fxbspiecewiseconstantparametrization.hpp.

+ Here is the call graph for this function:

◆ inverse()

Real inverse ( const Size  i,
const Real  y 
) const
overrideprotectedvirtual

Reimplemented from Parametrization.

Definition at line 74 of file fxbspiecewiseconstantparametrization.hpp.

+ Here is the call graph for this function:

◆ initialize()

void initialize ( const Array &  sigma)
private

Definition at line 41 of file fxbspiecewiseconstantparametrization.cpp.

41 {
42 QL_REQUIRE(PiecewiseConstantHelper1::t().size() + 1 == sigma.size(),
43 "alpha size (" << sigma.size() << ") inconsistent to times size ("
44 << PiecewiseConstantHelper1::t().size() << ")");
45
46 // store raw parameter values
47 for (Size i = 0; i < PiecewiseConstantHelper1::y_->size(); ++i) {
48 PiecewiseConstantHelper1::y_->setParam(i, inverse(0, sigma[i]));
49 }
50 update();
51}
Real inverse(const Size i, const Real y) const override
+ Here is the call graph for this function: