-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriModel01.h
More file actions
executable file
·48 lines (31 loc) · 1.17 KB
/
TriModel01.h
File metadata and controls
executable file
·48 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef TriModel01_h
#define TriModel01_h
class TriModel
{
private:
double S0; // initial stock price
double r; // continuous compounding interest rate
double q; // continuous dividend yield
double sigma; // volatility
double dx,v;
double dt; // time interval
public:
// constructor to initialize the data member by list
TriModel(double S0_, double r_, double q_, double sigma_):S0(S0_),r(r_),q(q_),sigma(sigma_)
{
}
// member function to work out time interval dt
// T is the maturity of the option, N is number of time steps
void Setdt(double T, int N);
// calculate the risk neutral probability of going up
double RiskNeutProb_up();
// calculate the risk neutral probability of going down
double RiskNeutProb_down();
// calculate the stock price at time step n and node i
double S(int n, int i);
// return the risk free interest rate r
double Getr();
// return time interval dt
double Getdt();
};
#endif