-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathVanillaMain1.cpp
58 lines (46 loc) · 1 KB
/
VanillaMain1.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
56
57
58
/* requires
DoubleDigital.cpp
PayOff2.cpp
Random1.cpp
SimpleMC3.cpp
Vanilla1.cpp
*/
#include "stdafx.h"
#include "SimpleMC3.h"
#include <iostream>
using namespace std;
#include "Vanilla1.h"
#include "Main.h"
int VanillaDemo()
{
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;
PayOff* thePayOff = new PayOffCall(Strike);
VanillaOption1 theOption(*thePayOff, Expiry);
double result = SimpleMonteCarlo3b(theOption,
Spot,
Vol,
r,
NumberOfPaths);
cout << "the price is " << result;
delete thePayOff;
double tmp;
cin >> tmp;
return 0;
}