QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
LongstaffSchwartzPathPricer< PathType > Class Template Reference

Longstaff-Schwarz path pricer for early exercise options. More...

#include <longstaffschwartzpathpricer.hpp>

+ Inheritance diagram for LongstaffSchwartzPathPricer< PathType >:
+ Collaboration diagram for LongstaffSchwartzPathPricer< PathType >:

Public Types

typedef EarlyExerciseTraits< PathType >::StateType StateType
 
- Public Types inherited from PathPricer< PathType, ValueType >
typedef ValueType result_type
 

Public Member Functions

 LongstaffSchwartzPathPricer (const TimeGrid &times, ext::shared_ptr< EarlyExercisePathPricer< PathType > >, const ext::shared_ptr< YieldTermStructure > &termStructure)
 
Real operator() (const PathType &path) const override
 
virtual void calibrate ()
 
Real exerciseProbability () const
 
- Public Member Functions inherited from PathPricer< PathType, ValueType >
virtual ~PathPricer ()=default
 
virtual ValueType operator() (const PathType &path) const =0
 

Protected Member Functions

virtual void post_processing (const Size i, const std::vector< StateType > &state, const std::vector< Real > &price, const std::vector< Real > &exercise)
 

Protected Attributes

bool calibrationPhase_ = true
 
const ext::shared_ptr< EarlyExercisePathPricer< PathType > > pathPricer_
 
QuantLib::IncrementalStatistics exerciseProbability_
 
std::unique_ptr< Array[]> coeff_
 
std::unique_ptr< DiscountFactor[]> dF_
 
std::vector< PathType > paths_
 
const std::vector< ext::function< Real(StateType)> > v_
 
const Size len_
 

Detailed Description

template<class PathType>
class QuantLib::LongstaffSchwartzPathPricer< PathType >

Longstaff-Schwarz path pricer for early exercise options.

References:

Francis Longstaff, Eduardo Schwartz, 2001. Valuing American Options by Simulation: A Simple Least-Squares Approach, The Review of Financial Studies, Volume 14, No. 1, 113-147

Tests:
the correctness of the returned value is tested by reproducing results available in web/literature

Definition at line 53 of file longstaffschwartzpathpricer.hpp.

Member Typedef Documentation

◆ StateType

typedef EarlyExerciseTraits<PathType>::StateType StateType

Definition at line 55 of file longstaffschwartzpathpricer.hpp.

Constructor & Destructor Documentation

◆ LongstaffSchwartzPathPricer()

LongstaffSchwartzPathPricer ( const TimeGrid times,
ext::shared_ptr< EarlyExercisePathPricer< PathType > >  pathPricer,
const ext::shared_ptr< YieldTermStructure > &  termStructure 
)

Definition at line 87 of file longstaffschwartzpathpricer.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ operator()()

Real operator() ( const PathType &  path) const
overridevirtual

◆ calibrate()

void calibrate
virtual

Definition at line 143 of file longstaffschwartzpathpricer.hpp.

+ Here is the call graph for this function:

◆ exerciseProbability()

Real exerciseProbability

Definition at line 209 of file longstaffschwartzpathpricer.hpp.

◆ post_processing()

virtual void post_processing ( const Size  i,
const std::vector< StateType > &  state,
const std::vector< Real > &  price,
const std::vector< Real > &  exercise 
)
protectedvirtual

Definition at line 67 of file longstaffschwartzpathpricer.hpp.

Member Data Documentation

◆ calibrationPhase_

bool calibrationPhase_ = true
protected

Definition at line 71 of file longstaffschwartzpathpricer.hpp.

◆ pathPricer_

const ext::shared_ptr<EarlyExercisePathPricer<PathType> > pathPricer_
protected

Definition at line 73 of file longstaffschwartzpathpricer.hpp.

◆ exerciseProbability_

QuantLib::IncrementalStatistics exerciseProbability_
mutableprotected

Definition at line 75 of file longstaffschwartzpathpricer.hpp.

◆ coeff_

std::unique_ptr<Array[]> coeff_
protected

Definition at line 77 of file longstaffschwartzpathpricer.hpp.

◆ dF_

std::unique_ptr<DiscountFactor[]> dF_
protected

Definition at line 78 of file longstaffschwartzpathpricer.hpp.

◆ paths_

std::vector<PathType> paths_
mutableprotected

Definition at line 80 of file longstaffschwartzpathpricer.hpp.

◆ v_

const std::vector<ext::function<Real(StateType)> > v_
protected

Definition at line 81 of file longstaffschwartzpathpricer.hpp.

◆ len_

const Size len_
protected

Definition at line 83 of file longstaffschwartzpathpricer.hpp.