Class implements algorithm solving pricing PDE. More...

#include <FdmPricer.hpp>

Public Member Functions

 FDMPricer (SmartPointer< FDScheme > scheme, SmartPointer< TridiagonalSolver > solver, SmartPointer< GridBuilder > sgrid, SmartPointer< GridBuilder > tgrid, SmartPointer< RangeSetup > range_setter)
 Constructor.
 
double price (Market m, SmartPointer< Option > o, int Ns=100, int Nt=200)
 Method pricing option. More...
 
void solveAndSave (Market market, SmartPointer< Option > option, std::string file, int Ns=100, int Nt=200)
 Method solves pricing PDE and save results to csv. More...
 

Private Attributes

SmartPointer< FDSchemescheme_
 FD scheme (Explicit, Implicit, etc)
 
SmartPointer< GridBuildersgrid_
 Algorithm generating spatial grid.
 
SmartPointer< GridBuildertgrid_
 Algorithm generating time grid.
 
SmartPointer< RangeSetuprange_setter_
 Algorithm defining range of grid.
 

Detailed Description

Class is implementation of strategy pattern (see [7]). Strategy pattern defines a family of algorithms, encapsulate each one, and make them interchangeable. The algorithms encapsulated in this class are:

  • Scheme for FD method
  • Spatial discretization
  • Time discretization
  • FDM Grid builder

Other object required by FDM solver (boundary and initial conditions) are obtained from abstract factory allocated by option being priced

Examples:
convergenceExample.cpp, and EuroOptExample.cpp.

Member Function Documentation

double marian::FDMPricer::price ( Market  mkt,
SmartPointer< Option option,
int  Ns = 100,
int  Nt = 200 
)

The steps of algorithm are as follows:

  • Obtaining concentration point and limits of the grid
  • Creating the grid
  • Calculating initial condition
  • Obtaining boundary condition
  • Creating diffusion process
  • Solving Backward Kolmogorov Equation
  • Interpolating results
Parameters
mktMarket data
optionFinancial option
NsNumber of spatial steps, default number 100
NtNumber of time steps, default number 200
Examples:
convergenceExample.cpp, and EuroOptExample.cpp.
void marian::FDMPricer::solveAndSave ( Market  mkt,
SmartPointer< Option option,
std::string  file,
int  Ns = 100,
int  Nt = 200 
)

The steps of algorithm are as follows:

  • Obtaining concentration point and limits of the grid
  • Creating the grid
  • Calculating initial condition
  • Obtaining boundary condition
  • Creating diffusion process
  • Solving Backward Kolmogorov Equation
  • Saves results to CSV
Parameters
mktMarket data
optionFinancial option
fileName of CSV file
NsNumber of spatial steps
NtNumber of time steps
Examples:
EuroOptExample.cpp.

The documentation for this class was generated from the following files:
  • C:/Unix/home/OEM/fdm/src/financial/FdmPricer.hpp
  • C:/Unix/home/OEM/fdm/src/financial/FdmPricer.cpp