-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
kraken.cpp
41 lines (32 loc) · 948 Bytes
/
kraken.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
#include <string.h>
#include <iostream>
#include <sstream>
#include <unistd.h>
#include <jansson.h>
#include "kraken.h"
#include "curl_fun.h"
namespace Kraken {
double getQuote(CURL *curl, bool isBid) {
double quote;
json_t *root = getJsonFromUrl(curl, "https://api.kraken.com/0/public/Ticker", "pair=XXBTZUSD");
if (isBid) {
quote = atof(json_string_value(json_array_get(json_object_get(json_object_get(json_object_get(root, "result"), "XXBTZUSD"), "b"), 0)));
} else {
quote = atof(json_string_value(json_array_get(json_object_get(json_object_get(json_object_get(root, "result"), "XXBTZUSD"), "a"), 0)));
}
json_decref(root);
return quote;
}
double getAvail(CURL *curl, Parameters params, std::string currency) {
// TODO
return 0.0;
}
double getActivePos(CURL *curl, Parameters params) {
// TODO
return 0.0;
}
double getLimitPrice(CURL *curl, double volume, bool isBid) {
// TODO
return 0.0;
}
}