marian::FDMPricer Class Reference
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< FDScheme > | scheme_ |
FD scheme (Explicit, Implicit, etc) | |
SmartPointer< GridBuilder > | sgrid_ |
Algorithm generating spatial grid. | |
SmartPointer< GridBuilder > | tgrid_ |
Algorithm generating time grid. | |
SmartPointer< RangeSetup > | range_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
-
mkt Market data option Financial option Ns Number of spatial steps, default number 100 Nt Number 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
-
mkt Market data option Financial option file Name of CSV file Ns Number of spatial steps Nt Number 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