-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
parameters.cpp
46 lines (37 loc) · 1.73 KB
/
parameters.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
#include <iostream>
#include <iomanip>
#include "parameters.h"
#include "time_fun.h"
// constructor
Parameters::Parameters(json_t *root) {
// strategy and global parameters
spreadEntry = json_real_value(json_object_get(root, "SpreadEntry"));
spreadExit = json_real_value(json_object_get(root, "SpreadExit"));
maxLength = json_integer_value(json_object_get(root, "MaxLength"));
verbose = json_boolean_value(json_object_get(root, "Verbose"));
// exchanges credentials
bitfinexApi = json_string_value(json_object_get(root, "BitfinexApiHead"));
bitfinexSecret = json_string_value(json_object_get(root, "BitfinexKey"));
okCoinApi = json_string_value(json_object_get(root, "OkCoinApiKey"));
okCoinSecret = json_string_value(json_object_get(root, "OkCoinSecretKey"));
bitstampClientId = json_string_value(json_object_get(root, "BitstampClientId"));
bitstampApi = json_string_value(json_object_get(root, "BitstampApiKey"));
bitstampSecret = json_string_value(json_object_get(root, "BitstampSecretKey"));
// email
sendEmail = json_boolean_value(json_object_get(root, "SendEmail"));
senderAddress = json_string_value(json_object_get(root, "SenderAddress"));
senderUsername = json_string_value(json_object_get(root, "SenderUsername"));
senderPassword = json_string_value(json_object_get(root, "SenderPassword"));
smtpServerAddress = json_string_value(json_object_get(root, "SmtpServerAddress"));
receiverAddress = json_string_value(json_object_get(root, "ReceiverAddress"));
}
// add an exchange
void Parameters::addExchange(std::string n, double f, bool h) {
exchName.push_back(n);
fees.push_back(f);
hasShort.push_back(h);
}
// returns number of exchanges
unsigned Parameters::nbExch() const {
return exchName.size();
}