Skip to content

danielhstahl/FangOost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux Windows Codecov
lin-badge win-badge cov-badge

This is a generic implementation of the Fang-Oosterlee paper for inverting density functions and convolutions. Depends on my Functional Utilities library.

The library falls into two categories: a "Levy" section which assumes that the characteristic function and the integrand depend on a common variable, and a standard section where the characteristic function and integrand do not depend on a common variable. To price options, the characteristic function is of the form exp(ui x_0+\phi(u)) where x_0 is equal to log(S/K) and K iterates over all required strikes. Hence when integrating, the characteristic function must be re-evaluated at every interval. Without this requirement, the algorithm is more efficient since the characteristic function can be evaluated once for every discrete u.

To see how this algorithm can be used, see the test code, my FFTOptionPricing repo, and my cfdistutilities repo.

Some API oddities

The computeInvDiscrete functions (and some of the other discrete functions) assume that the CF has already been multiplied by cp; see the test cases with computeInvDiscrete. However, some discrete functions do take a "raw" CF: see for example computeInvDiscreteLog. The reason is that adding cp is not added to the computeInvDiscrete function is for efficiency purposes.

Limitations

For densities without derivatives of all orders, the convergence may be slow. For example, Beta distributions may not converge at all when the mode of the distribution is near zero or one.

About

Improved and more generic version of Fang and Oosterlee's algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages