-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
47 lines (31 loc) · 2.08 KB
/
main.cpp
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
#include <iostream>
#include "option.h"
int main(int argc, const char * argv[]) {
AmericanCall AmCallBt(100, 1, 0.1348, 0.06);
std::cout << "American Call price using Binomial Tree Model: " << AmCallBt.getBinomialTreeValue(100, 3) << std::endl;
AmericanCall AmCallBS(100, 1, 0.1348, 0.06);
std::cout << "American Call price using Black Scholes Model: " << AmCallBS.getBlackScholesValue(100) << std::endl;
AmericanPut AmPutBt(52, 2, 0.3, 0.05);
std::cout << "American price using Binomial Tree Model: " << AmPutBt.getBinomialTreeValue(50, 2) << std::endl;
AmericanPut AmPutBs(52, 2, 0.3, 0.05);
std::cout << "American Put price using Black Scholes Model: " << AmPutBs.getBlackScholesValue(50) << std::endl;
AmericanCall AmCallwDy(100, 1, 0.1348, 0.06);
std::cout << "American Call with dividend: " << AmCallwDy.getBinomialTreeValue(105, 3,0.02) << std::endl;
AmericanPut AmPutwDy(100, 1.5, 0.2579, 0.05);
std::cout << "American Put with dividend: " << AmPutwDy.getBinomialTreeValue(96, 3,0.02) << std::endl;
EuropeanCall EuCallBs(800, 0.5, 0.20, 0.025);
std::cout << "European Call price using Black Scholes Model: " << EuCallBs.getBlackScholesValue(810) << std::endl;
EuropeanCall EuCallBt(800, 0.5, 0.20, 0.025);
std::cout << "European Call price using Binomial Tree Model: " << EuCallBt.getBinomialTreeValue(810,2) << std::endl;
EuropeanPut EuPutBs(63.75, 1, 0.2, 0.04);
std::cout << "European put price using Black Scholes Model: " << EuPutBs.getBlackScholesValue(75) << std::endl;
EuropeanPut EuPutBt(63.75, 1, 0.2, 0.04);
std::cout << "European put price using Binomial Tree Model: " << EuPutBt.getBinomialTreeValue(75,3) << std::endl;
KnockOutCall koCall(120, 1, 0.3, 0.06, 130);
std::cout << "Knockout Call: " << koCall.getBinomialTreeValue(125, 500) << std::endl;
KnockOutPut koPut(80, 0.5, 0.25, 0.04, 75);
std::cout << "Knockout Put: " << koPut.getBinomialTreeValue(70, 300) << std::endl;
return 0;
}
// compile code and chnage : g++ -o option main.cpp option.cpp -lm
// Run : .\option.exe