Class DirectIntegrationPricer

Inheritance Relationships

Base Type

Class Documentation

class DirectIntegrationPricer : public otyca::StochasticProcessPricer

Option pricer using direct integration in the Fourier domain.

This class implements a numerically efficient option pricing technique based on Fourier inversion, as proposed by Kilin (2007) and Attari (2004). It computes option prices, derivatives, implied volatilities, and PDFs using the characteristic function of a given stochastic process.

Public Functions

DirectIntegrationPricer(unsigned int order = 128)

Construct a new DirectIntegrationPricer with a given integration order.

Parameters:

order – Number of quadrature points (default: 128).

virtual ~DirectIntegrationPricer()

Destroy the pricer and deallocate internal buffers.

inline virtual std::string name()

Return the name of the pricer.

Returns:

A string representing the name.

virtual std::vector<std::vector<double>> price(const StochasticProcess *process, const std::vector<double> &tenors, const std::vector<std::vector<double>> &strikes, StrikeType strike_type = LOG_STRIKE) const override

Prices for multiple tenors and strike sets.

Parameters:
  • stochastic_process – Pointer to the stochastic process model.

  • tenors – Vector of tenors.

  • strikes – 2D vector of strikes (per tenor).

  • strike_type – Type of strike to use. See StrikeType for available options.

Returns:

2D vector of prices.

virtual std::vector<std::vector<std::vector<double>>> price_derivatives(const StochasticProcess *process, const std::vector<double> &tenors, const std::vector<std::vector<double>> &strikes, StrikeType strike_type = LOG_STRIKE) const override

Analytical price derivatives for each input.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenors – Vector of tenors.

  • strikes – 2D strike array.

  • strike_type – Strike type to interpret. See StrikeType for available options.

Returns:

3D vector of derivatives.

virtual std::vector<std::vector<double>> implied_volatility(const StochasticProcess *process, const std::vector<double> &tenors, const std::vector<std::vector<double>> &strikes, StrikeType strike_type = LOG_STRIKE, double tolerance = 1e-4) const override

Implied volatilities for multiple tenors and strike sets.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenors – Tenor vector.

  • strikes – 2D strike array.

  • strike_type – Strike type. See StrikeType for available options.

  • tolerance – Root-finding tolerance.

Returns:

2D vector of implied volatilities.

virtual std::vector<std::vector<double>> pdf(const StochasticProcess *process, const std::vector<double> &tenors, const std::vector<std::vector<double>> &strikes, StrikeType strike_type = LOG_STRIKE) const override

Returns PDFs for multiple tenors and strikes.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenors – Vector of tenors.

  • strikes – 2D vector of strikes.

  • strike_type – Strike type. See StrikeType for available options.

Returns:

2D vector of PDF values.

double implied_volatility(const StochasticProcess *stochastic_process, double tenor, double strike, StrikeType strike_type = LOG_STRIKE, double tolerance = 1e-4) const

Calculates implied volatility for one option.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenor – Tenor.

  • strike – Strike.

  • strike_type – Strike type. See StrikeType for available options.

  • tolerance – Root-finding tolerance.

Returns:

Implied volatility.

std::vector<double> implied_volatility(const StochasticProcess *stochastic_process, double tenor, const std::vector<double> &strikes, StrikeType strike_type = LOG_STRIKE, double tolerance = 1e-4) const

Implied volatilities for a vector of strikes at a given tenor.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenor – Tenor.

  • strikes – Strike vector.

  • strike_type – Strike type. See StrikeType for available options.

  • tolerance – Root-finding tolerance.

Returns:

Vector of implied volatilities.

virtual std::vector<std::vector<double>> implied_volatility(const StochasticProcess *stochastic_process, const std::vector<double> &tenors, const std::vector<std::vector<double>> &strikes, StrikeType strike_type = LOG_STRIKE, double tolerance = 1e-4) const = 0

Implied volatilities for multiple tenors and strike sets.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenors – Tenor vector.

  • strikes – 2D strike array.

  • strike_type – Strike type. See StrikeType for available options.

  • tolerance – Root-finding tolerance.

Returns:

2D vector of implied volatilities.

double pdf(const StochasticProcess *stochastic_process, double tenor, double strike, StrikeType strike_type = LOG_STRIKE) const

Returns PDF value at a given tenor and strike.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenor – Tenor.

  • strike – Strike.

  • strike_type – Strike type. See StrikeType for available options.

Returns:

PDF value.

std::vector<double> pdf(const StochasticProcess *stochastic_process, double tenor, const std::vector<double> &strikes, StrikeType strike_type = LOG_STRIKE) const

Returns PDF values for a vector of strikes.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenor – Tenor.

  • strikes – Strike vector.

  • strike_type – Strike type. See StrikeType for available options.

Returns:

Vector of PDF values.

virtual std::vector<std::vector<double>> pdf(const StochasticProcess *stochastic_process, const std::vector<double> &tenors, const std::vector<std::vector<double>> &strikes, StrikeType strike_type = LOG_STRIKE) const = 0

Returns PDFs for multiple tenors and strikes.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenors – Vector of tenors.

  • strikes – 2D vector of strikes.

  • strike_type – Strike type. See StrikeType for available options.

Returns:

2D vector of PDF values.

virtual std::vector<std::vector<double>> price(const StochasticProcess *stochastic_process, const std::vector<double> &tenors, const std::vector<std::vector<double>> &strikes, StrikeType strike_type = LOG_STRIKE) const = 0

Prices for multiple tenors and strike sets.

Parameters:
  • stochastic_process – Pointer to the stochastic process model.

  • tenors – Vector of tenors.

  • strikes – 2D vector of strikes (per tenor).

  • strike_type – Type of strike to use. See StrikeType for available options.

Returns:

2D vector of prices.

std::vector<double> price(const StochasticProcess *stochastic_process, double tenor, const std::vector<double> &strikes, StrikeType strike_type = LOG_STRIKE) const

Prices for a single tenor and set of strikes.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenor – Single tenor value.

  • strikes – Strike vector.

  • strike_type – Strike type. See StrikeType for available options.

Returns:

Vector of prices.

double price(const StochasticProcess *stochastic_process, double tenor, double strike, StrikeType strike_type = LOG_STRIKE) const

Prices a single option.

Parameters:
  • stochastic_process – Pointer to stochastic process.

  • tenor – Tenor value.

  • strike – Strike value.

  • strike_type – Strike type.

Returns:

Option price.

Public Members

double *_x

Precomputed integration points.

double *_w

Precomputed integration weights.

arma::vec _exp_u

Exponential of u for transform.

arma::vec _u2_real

Real part of u^2.

arma::colvec _w_col

Quadrature weights as arma column vector.

arma::colvec _x_col

Quadrature points as arma column vector.

arma::cx_colvec _u

Complex-valued quadrature vector u.

arma::cx_colvec _iu

Precomputed i * u.

arma::cx_colvec _u2

Precomputed u^2.

unsigned int _order

Number of quadrature points.