-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain04.cpp
43 lines (33 loc) · 991 Bytes
/
Main04.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
#include <iostream>
#include "PathDepOption.h"
#include "GmtrAsianCall.h"
using namespace std;
using namespace fre;
int main()
{
double S0=100.0, r=0.03, sigma=0.2;
MCModel Model(S0,r,sigma);
double T =1.0/12.0, K=100.0;
int m=30;
ArthmAsianCall Option(T,K,m);
GmtrAsianCall CVOption(T,K,m);
long N=30000;
double epsilon =0.001;
Option.PriceByVarRedMC(Model,N,CVOption,epsilon);
cout << "Arithmetic call price = " << Option.GetPrice() << endl
<< "Error = " << Option.GetPricingError() << endl
<< "Delta = " << Option.GetDelta() << endl << endl;
Option.PriceByMC(Model,N,epsilon);
cout << "Price by direct MC = " << Option.GetPrice() << endl
<< "Error = " << Option.GetPricingError() << endl
<< "Delta = " << Option.GetDelta() << endl << endl;
return 0;
}
/*
Arithmetic call price = 1.42615
Error = 0.000139644
Delta = 0.518651
Price by direct MC = 1.43208
Error = 0.0121643
Delta = 0.524516
*/