-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
171 lines (153 loc) · 6.37 KB
/
main.cpp
File metadata and controls
171 lines (153 loc) · 6.37 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// @file main.cpp
// @version 1.0.0
// @author Nikolaii Lodenos @ CEO
// @create 03 February 2018
// @modify Nikolaii Lodenos @ CEO
// @update 10 May 2018
#include "Themis.hpp"
using namespace hg;
///
/// @fn int
/// main(int argc, char** argv)
///
/// @brief The only main entry point, supreme function.
///
int
main(int argc, char** argv)
{
Themis bit;
if (argc == 1) {
cout << "> No argument is passed as parameter." << endl;
return -1;
} else if (argc == 2) {
if (bit.set_access(argv[1]) == false) {
cout << "An error occurred while opening the file " << argv[1] << endl;
return -1;
}
bit.launch_perpetual_green_process("bitfinex");
} else {
cout << "> Only one argument is allowed in parameter." << endl;
return -1;
}
return 0;
}
// int
// main(void)
// {
// Themis bit;
// infoPath_t* path = new infoPath_t;
// orderBook_t **orderBook = new orderBook_t*[3];
// path->index[0] = 0;
// path->index[1] = 1;
// path->index[2] = 2;
// orderBook[0] = new orderBook_t;
// orderBook[1] = new orderBook_t;
// orderBook[2] = new orderBook_t;
// orderBook[0]->ask = new order_t;
// orderBook[0]->ask->next = new order_t;
// orderBook[0]->ask->price = 0;
// orderBook[0]->ask->amount = 0;
// orderBook[0]->ask->prev = orderBook[0]->ask->next;
// orderBook[0]->ask->next->next = orderBook[0]->ask;
// orderBook[0]->ask->next->prev = orderBook[0]->ask;
// orderBook[0]->ask->next->price = 1;
// orderBook[0]->ask->next->amount = 110;
// orderBook[0]->bid = new order_t;
// orderBook[0]->bid->next = new order_t;
// orderBook[0]->bid->price = 0;
// orderBook[0]->bid->amount = 0;
// orderBook[0]->bid->prev = orderBook[0]->bid->next;
// orderBook[0]->bid->next->next = orderBook[0]->bid;
// orderBook[0]->bid->next->prev = orderBook[0]->bid;
// orderBook[0]->bid->next->price = 1;
// orderBook[0]->bid->next->amount = 100;
// orderBook[1]->ask = new order_t;
// orderBook[1]->ask->next = new order_t;
// orderBook[1]->ask->price = 0;
// orderBook[1]->ask->amount = 0;
// orderBook[1]->ask->prev = orderBook[1]->ask->next;
// orderBook[1]->ask->next->next = orderBook[1]->ask;
// orderBook[1]->ask->next->prev = orderBook[1]->ask;
// orderBook[1]->ask->next->price = 1;
// orderBook[1]->ask->next->amount = 100;
// orderBook[1]->bid = new order_t;
// orderBook[1]->bid->next = new order_t;
// orderBook[1]->bid->price = 0;
// orderBook[1]->bid->amount = 0;
// orderBook[1]->bid->prev = orderBook[1]->bid->next;
// orderBook[1]->bid->next->next = orderBook[1]->bid;
// orderBook[1]->bid->next->prev = orderBook[1]->bid;
// orderBook[1]->bid->next->price = 1;
// orderBook[1]->bid->next->amount = 100;
// orderBook[2]->ask = new order_t;
// orderBook[2]->ask->next = new order_t;
// orderBook[2]->ask->price = 0;
// orderBook[2]->ask->amount = 0;
// orderBook[2]->ask->prev = orderBook[2]->ask->next;
// orderBook[2]->ask->next->next = orderBook[2]->ask;
// orderBook[2]->ask->next->prev = orderBook[2]->ask;
// orderBook[2]->ask->next->price = 0.5;
// orderBook[2]->ask->next->amount = 100;
// orderBook[2]->bid = new order_t;
// orderBook[2]->bid->next = new order_t;
// orderBook[2]->bid->price = 0;
// orderBook[2]->bid->amount = 0;
// orderBook[2]->bid->prev = orderBook[2]->bid->next;
// orderBook[2]->bid->next->next = orderBook[2]->bid;
// orderBook[2]->bid->next->prev = orderBook[2]->bid;
// orderBook[2]->bid->next->price = 2;
// orderBook[2]->bid->next->amount = 100;
// bit.set_fees(0, 0.001);
// cout << "-------------------------------------" << endl << "Tests deuxieme paire" << endl << endl;
// cout << "Fees : 0.1%, Buy/Buy/Sell, Gain : 99.5000998998999" << endl;
// cout << "Expect 100 100 99.9" << endl;
// path->side[0] = 0;
// path->side[1] = 0;
// path->side[2] = 1;
// if (!bit.winner_path(orderBook, NULL, path))
// cout << "Pas de gain" << endl;
// cout << "Gain : " << path->gain << endl;
// cout << "Amount[0] : " << setprecision(10) << path->amount[0] << endl;
// cout << "Amount[1] : " << setprecision(10) << path->amount[1] << endl;
// cout << "Amount[2] : " << setprecision(10) << path->amount[2] << endl;
// cout << "-------------------------------------" << endl << "Tests troisieme paire" << endl << endl;
// orderBook[2]->bid->next->amount = 30;
// orderBook[2]->bid->next->next = new order_t;
// orderBook[2]->bid->next->next->prev = orderBook[2]->bid->next;
// orderBook[2]->bid->next->next->next = orderBook[2]->bid;
// orderBook[2]->bid->next->next->price = 1;
// orderBook[2]->bid->next->next->amount = 100;
// cout << "Fees : 0.1%, Buy/Buy/Sell, Gain : 29.8799" << endl;
// cout << "Expect 30.0601 30.03 30" << endl;
// if (!bit.winner_path(orderBook, NULL, path))
// cout << "Pas de gain" << endl;
// cout << "Gain : " << path->gain << endl;
// cout << "Amount[0] : " << setprecision(10) << path->amount[0] << endl;
// cout << "Amount[1] : " << setprecision(10) << path->amount[1] << endl;
// cout << "Amount[2] : " << setprecision(10) << path->amount[2] << endl;
// path->side[2] = 0;
// cout << endl << "Fees : 0.1%, Buy/Buy/Buy, Gain : 49.7998498" << endl;
// cout << "Expect 50.1001502 50.05005005 100" << endl;
// if (!bit.winner_path(orderBook, NULL, path))
// cout << "Pas de gain" << endl;
// cout << "Gain : " << path->gain << endl;
// cout << "Amount[0] : " << setprecision(10) << path->amount[0] << endl;
// cout << "Amount[1] : " << setprecision(10) << path->amount[1] << endl;
// cout << "Amount[2] : " << setprecision(10) << path->amount[2] << endl;
// cout << "-------------------------------------" << endl << "Tests premiere paire" << endl << endl;
// cout << "Fees : 0.1%, Buy/Buy/Sell, Gain : 43.7032969" << endl;
// cout << "Expect 110 109.89 109.78011" << endl;
// path->side[0] = 0;
// path->side[1] = 0;
// path->side[2] = 1;
// orderBook[0]->ask->next->price = 0.5;
// orderBook[1]->ask->next->amount = 200;
// orderBook[2]->bid->next->price = 0.9;
// orderBook[2]->bid->next->amount = 200;
// if (!bit.winner_path(orderBook, NULL, path))
// cout << "Pas de gain" << endl;
// cout << "Gain : " << path->gain << endl;
// cout << "Amount[0] : " << setprecision(10) << path->amount[0] << endl;
// cout << "Amount[1] : " << setprecision(10) << path->amount[1] << endl;
// cout << "Amount[2] : " << setprecision(10) << path->amount[2] << endl;
// }