-
Notifications
You must be signed in to change notification settings - Fork 0
/
lattice_product_t.h
68 lines (48 loc) · 1.64 KB
/
lattice_product_t.h
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
59
60
61
62
63
64
65
66
67
68
#pragma once
#if !defined(_LATTICE_PRODUCT_H)
#define _LATTICE_PRODUCT_H
#include"lattice_product.h"
#include"lattice_product_builder.h"
void testOptionBuilder() {
using lattice_product::Option;
using lattice_product_builder::OptionBuilder;
auto option = OptionBuilder<double>()
.withName("plain option")
.withDividend(12)
.withPeriods(10)
.withSpot(60.0)
.build();
auto params = option.modelParams();
std::cout << "option builder:\n";
std::cout << "option div: " << option.dividend() << "\n";
std::cout << "option name: " << option.name() << "\n";
std::cout << "option periods: " << option.periods() << "\n";
}
void testBarrierOptionBuilder() {
using lattice_product::BarrierOption;
using lattice_product_builder::BarrierOptionBuilder;
auto option = BarrierOptionBuilder<double>()
.withName("plain barrier option")
.withDividend(12)
.withPeriods(10)
.build();
auto params = option.modelParams();
std::cout << "option builder:\n";
std::cout << "option div: " << option.dividend() << "\n";
std::cout << "option name: " << option.name() << "\n";
std::cout << "option periods: " << option.periods() << "\n";
}
void testPureDiscountBondBuilder() {
using lattice_product::PureDiscountBond;
using lattice_product_builder::PureDiscountBondBuilder;
auto option = PureDiscountBondBuilder<double>()
.withName("pure discount option")
.withNominal(100)
.withPeriods(10)
.build();
std::cout << "option builder:\n";
std::cout << "option nominal: " << option.nominal() << "\n";
std::cout << "option name: " << option.name() << "\n";
std::cout << "option periods: " << option.periods() << "\n";
}
#endif ///_LATTICE_PRODUCT_H