-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVanillaMain2.cpp
55 lines (44 loc) · 973 Bytes
/
VanillaMain2.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
48
49
50
51
52
53
54
55
/* requires
PayOff3.cpp
Random1.cpp
SimpleMC4.cpp
Vanilla2.cpp
*/
#include "stdafx.h"
#include "SimpleMC4.h"
#include <iostream>
using namespace std;
#include "Vanilla2.h"
#include "Main.h"
int VanillaDemo2()
{
double Expiry;
double Strike;
double Spot;
double Vol;
double r;
unsigned long NumberOfPaths;
cout << "\nEnter expiry e.g. 0.25 (time to expire)\n";
cin >> Expiry;
cout << "\nEnter strike e.g. 200 \n";
cin >> Strike;
cout << "\nEnter spot e.g. 195 \n";
cin >> Spot;
cout << "\nEnter vol e.g. 0.30 \n";
cin >> Vol;
cout << "\nr (risk free rate) e.g. 0.05 \n";
cin >> r;
cout << "\nNumber of paths e.g. 1000\n";
cin >> NumberOfPaths;
PayOffCall thePayOff(Strike);
VanillaOption2 theOption(thePayOff, Expiry);
double result = SimpleMonteCarlo3a(theOption,
Spot,
Vol,
r,
NumberOfPaths);
cout << "the price is " << result;
double tmp;
cin >> tmp;
return 0;
}