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
|
#include <iostream>
#include "BlackScholes.h"
int main() {
std::cout << "Question 1 \n\n";
// Q 1.1
BlackScholes bs1 {50.0, 50.0, 0.0, 0.5, 0.2, 0.01};
double call_value {};
double put_value {};
call_value = bs1.derive_c();
put_value = bs1.derive_p();
std::cout << "Q1.1 " << "Call Option Value: " << call_value << std::endl;
std::cout << "Q1.1 " << "Put Option Value: " << put_value << std::endl;
// Q 1.2
BlackScholes bs2 {50.0, 60.0, 0.0, 0.5, 0.2, 0.01};
call_value = bs2.derive_c();
put_value = bs2.derive_p();
std::cout << "Q1.2 " << "Call Option Value: " << call_value << std::endl;
std::cout << "Q1.2 " << "Put Option Value: " << put_value << std::endl;
// Q 1.3
BlackScholes bs3 {50.0, 50.0, 0.0, 1.0, 0.2, 0.01};
call_value = bs3.derive_c();
put_value = bs3.derive_p();
std::cout << "Q1.3 " << "Call Option Value: " << call_value << std::endl;
std::cout << "Q1.3 " << "Put Option Value: " << put_value << std::endl;
// Q 1.4
BlackScholes bs4 {50.0, 50.0, 0.0, 0.5, 0.3, 0.01};
call_value = bs4.derive_c();
put_value = bs4.derive_p();
std::cout << "Q1.4 " << "Call Option Value: " << call_value << std::endl;
std::cout << "Q1.4 " << "Put Option Value: " << put_value << std::endl;
// Q 1.5
BlackScholes bs5 {50.0, 50.0, 0.0, 0.5, 0.2, 0.02};
call_value = bs5.derive_c();
put_value = bs5.derive_p();
std::cout << "Q1.5 " << "Call Option Value: " << call_value << std::endl;
std::cout << "Q1.5 " << "Put Option Value: " << put_value << std::endl;
return 0;
}
|