Skip to content

Commit

Permalink
Update hestonModel.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lyndskg committed Jan 7, 2024
1 parent fafcec5 commit f519a7e
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions include/black-scholes-cpp/hestonModel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//
// hestonModel.h
// black-scholes
// black-scholes-cpp
//
// Created by lyndskg on 7/18/23.

Expand All @@ -17,23 +16,25 @@
using namespace std;

class hestonModel : public optionGreeksModel {
public:
// ----------------------------------------------------------------------------
// "hestonModel" Class Declarations
// ----------------------------------------------------------------------------
/*------------------------------ CONSTRUCTORS ------------------------------*/
public:

// ---------------------------------------------------------------------------------------
// "hestonModel" Class Declarations
// ---------------------------------------------------------------------------------------
/*------------------------------------ CONSTRUCTORS -----------------------------------*/
hestonModel();

hestonModel(double underlyingPrice, double strikePrice, double riskFreeRate,
double timeToExpiration, double volatility, double V0, double kappa,
double theta, double sigma, double rho, OptionType optionType);

/*--------------------------- KEY MEMBER FUNCTIONS ---------------------------*/


/*-------------------------------- KEY MEMBER FUNCTIONS --------------------------------*/
/* Calculates the option price using the Heston model with stochastic volatility.
It uses Euler discretization to approximate the variance process over time,
and then calculates the option price based on the type of option (call or put)
using the Black-Scholes formula with Heston volatility.*/
//

// Time complexity: O(num_time_steps)
// Space complexity: O(1)
double calculateOptionPrice();
Expand All @@ -43,82 +44,83 @@ class hestonModel : public optionGreeksModel {
double random_normal();


/*---------------------------- SETTER METHODS ----------------------------*/
/*----------------------------------- SETTER METHODS -----------------------------------*/

// Setter method for V0.
//

// Time complexity: O(1)
// Space complexity: O(1)
void setV0(double value) const;


// Setter method for Kappa.
//

// Time complexity: O(1)
// Space complexity: O(1)
void setKappa(double value) const;


// Setter method for Theta.
//

// Time complexity: O(1)
// Space complexity: O(1)
void setTheta(double value) const;


// Setter method for Sigma.
//

// Time complexity: O(1)
// Space complexity: O(1)
void setSigma(double value) const;


// Setter method for Rho.
//

// Time complexity: O(1)
// Space complexity: O(1)
void setRho(double value) const;


/*---------------------------- GETTER METHODS ----------------------------*/
/*----------------------------------- GETTER METHODS -----------------------------------*/
// Getter method for V0.
//

// Time complexity: O(1)
// Space complexity: O(1)
const double& getV0() const;


// Getter method for Kappa.
//

// Time complexity: O(1)
// Space complexity: O(1)
const double& getKappa() const;


// Getter method for Theta.
//

// Time complexity: O(1)
// Space complexity: O(1)
const double& getTheta() const;


// Getter method for Sigma.
//

// Time complexity: O(1)
// Space complexity: O(1)
const double& getSigma() const;


// Getter method for Rho.
//

// Time complexity: O(1)
// Space complexity: O(1)
const double& getRho() const;


private:
// ----------------------------------------------------------------------------
// "hestonModel" Member Variables
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
// "hestonModel" Member Variables
// -----------------------------------------------------------------------------------
// Heston Model Parameters
mutable double V0_; // Initial volatility
mutable double kappa_; // Mean reversion speed
Expand Down

0 comments on commit f519a7e

Please sign in to comment.