Skip to content

Commit dad8fab

Browse files
MapleMaple
authored andcommitted
last working
1 parent 9739659 commit dad8fab

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

include/bfx-api-cpp/BitfinexAPI.hpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ namespace BfxAPI
115115
bfxApiStatusCode_(noError)
116116
{
117117
// populate _symbols directly from Bitfinex getSymbols endpoint
118-
getSymbols();
119-
jsonutils::jsonStrToUset(symbols_, result_);
118+
jsonutils::jsonStrToUset(symbols_, getSymbols().strResponse());
120119
result_.clear();
121120

122121
currencies_ =
@@ -904,17 +903,21 @@ namespace BfxAPI
904903
// Private attributes
905904
////////////////////////////////////////////////////////////////////////
906905

906+
// containers with supported parameters
907907
unordered_set<string> symbols_; // valid symbol pairs
908908
unordered_set<string> currencies_; // valid currencies
909909
unordered_set<string> methods_; // valid deposit methods
910910
unordered_set<string> walletNames_; // valid walletTypes
911911
unordered_set<string> types_; // valid Types (see new order endpoint)
912-
string WDconfFilePath_;
913-
string APIurl_;
914-
string accessKey_, secretKey_;
912+
// CURL instances
915913
CURL *curlGET_;
916914
CURL *curlPOST_;
917915
CURLcode curlStatusCode_;
916+
// BitfinexAPI settings
917+
string WDconfFilePath_;
918+
string APIurl_;
919+
string accessKey_, secretKey_;
920+
// dynamic and status variables
918921
bfxERR bfxApiStatusCode_;
919922
string result_;
920923

@@ -1086,7 +1089,7 @@ namespace BfxAPI
10861089
return to_string(ms.count());
10871090
};
10881091

1089-
static int getBase64(const string &content, string &encoded)
1092+
static void getBase64(const string &content, string &encoded)
10901093
{
10911094
using CryptoPP::Base64Encoder;
10921095
using CryptoPP::StringSink;
@@ -1101,13 +1104,11 @@ namespace BfxAPI
11011104
content.length(),
11021105
true,
11031106
new Base64Encoder(new StringSink(encoded), false));
1104-
1105-
return 0;
11061107
};
11071108

1108-
static int getHmacSha384(const string &key,
1109-
const string &content,
1110-
string &digest)
1109+
static void getHmacSha384(const string &key,
1110+
const string &content,
1111+
string &digest)
11111112
{
11121113
using CryptoPP::HashFilter;
11131114
using CryptoPP::HexEncoder;
@@ -1127,8 +1128,6 @@ namespace BfxAPI
11271128
new HashFilter(hmac, new StringSink(mac)));
11281129
StringSource ss2(mac, true, new HexEncoder(new StringSink(digest)));
11291130
transform(digest.cbegin(), digest.cend(), digest.begin(), ::tolower);
1130-
1131-
return 0;
11321131
};
11331132

11341133
// Curl write callback function. Appends fetched *content to *userp

include/bfx-api-cpp/jsonutils.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ namespace jsonutils
118118
} state_;
119119
};
120120

121-
bfxERR jsonStrToUset(unordered_set<string> &uSet, string &jsonStr)
121+
bfxERR jsonStrToUset(unordered_set<string> &uSet, const string &jsonStr)
122122
{
123123
// Create schema $ref resolver
124124
rj::Document sd;
@@ -143,7 +143,7 @@ namespace jsonutils
143143

144144
// Create input JSON StringStream
145145
rj::StringStream ss(jsonStr.c_str());
146-
// rj::StringStream ss(mockJson.c_str());
146+
// rj::StringStream ss(mockJson.c_str()); // DEBUG
147147

148148
// Parse and validate
149149
if (!reader.Parse(ss, validator))

0 commit comments

Comments
 (0)