Skip to content

Commit

Permalink
Fixed Poloniex --list and handshake (but orders are still broken).
Browse files Browse the repository at this point in the history
████ ███  To request new features or in case this commit breaks something for you,
████ ███  please, create a new github issue with all possible information for me,
▓███▀█▄   but never share your API Keys!
▒▓██ ███
░▒▓█ ███  Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
 _________________________________________
/ Hello, WORLD!                           \
|                                         |
\ pssst.. 1.00000000 BTC = 58109.46 EUR.  /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
  • Loading branch information
ctubio committed Sep 27, 2024
1 parent 014a9dc commit e4cc521
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ K ?= K.sh
MAJOR = 0
MINOR = 7
PATCH = 0
BUILD = 17
BUILD = 18

OBLIGATORY = DISCLAIMER: This is strict non-violent software: \n$\
if you hurt other living creatures, please stop; \n$\
Expand Down
42 changes: 22 additions & 20 deletions src/lib/Krypto.ninja-apis.h
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,8 @@ class GwApiWsFix: public GwApiWs,
http = "https://api.poloniex.com";
ws = "wss://ws.poloniex.com";
randId = Random::int45Id;
webMarket = "https://poloniex.com/exchange/";
webOrders = "https://poloniex.com/tradeHistory";
webMarket = "https://poloniex.com/trade/";
webOrders = "https://poloniex.com/activity/spot/open-orders";
};
string web(const string &base, const string &quote) const override {
return webMarket + quote + "_" + base;
Expand All @@ -1188,31 +1188,33 @@ class GwApiWsFix: public GwApiWs,
return to_string(Tstamp);
};
void pairs(string &report) const override {
const json reply = Curl::Web::xfer(*guard, http + "/public?command=returnTicker");
if (!reply.is_object())
const json reply = Curl::Web::xfer(*guard, http + "/markets");
if (!reply.is_array())
print("Error while reading pairs: " + reply.dump());
else for (auto it = reply.begin(); it != reply.end(); ++it)
report += it.key() + ANSI_NEW_LINE;
else for (auto &it : reply)
if (it.value("state", "") == "NORMAL")
report += it.value("displayName", "") + ANSI_NEW_LINE;
};
json handshake() const override {
const json reply = Curl::Web::xfer(*guard, http + "/public?command=returnTicker")
.value(quote + "_" + base, json::object());
json reply = Curl::Web::xfer(*guard, http + "/markets/" + base + "_" + quote);
if (reply.is_array() and !reply.empty() and reply.at(0).value("state", "") == "NORMAL" and reply.at(0).at("symbolTradeLimit").is_object())
reply = reply.at(0).at("symbolTradeLimit");
return {
{ "base", base },
{ "quote", quote },
{ "symbol", quote + "_" + base},
{"tickPrice", reply.empty()
? 0 : 1e-8 },
{ "tickSize", 1e-8 },
{ "minSize", 1e-4 },
{ "reply", reply }
{ "base", base },
{ "quote", quote },
{ "symbol", base + "_" + quote },
{"tickPrice", pow(10, -reply.value("priceScale", 0)) },
{ "tickSize", pow(10, -reply.value("quantityScale", 0))},
{ "minSize", stod(reply.value("minQuantity", "0")) },
{ "reply", reply }
};
};
json xfer(const string &url, const string &post, const string &h1, const string &h2) const {
json xfer(const string &url, const string &post, const string &h1, const string &h2, const string &h3) const {
return Curl::Web::xfer(*guard, url, "GET", post, {
"Content-Type: application/x-www-form-urlencoded",
"Key: " + h1,
"Sign: " + h2
"Content-Type: application/json",
"key: " + h1,
"signature: " + h2,
"signTimestamp: " + h3
});
};
};
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Krypto.ninja-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export define PACKAGE_JSON
"@angular/platform-browser": "^18.2.6",
"@angular/platform-browser-dynamic": "^18.2.6",
"@angular/router": "^18.2.6",
"@types/node": "^22.7.2",
"ag-grid-angular": "^32.2.0",
"ag-grid-community": "^32.2.0",
"@types/node": "^22.7.3",
"ag-grid-angular": "^32.2.1",
"ag-grid-community": "^32.2.1",
"esbuild": "^0.24.0",
"highcharts": "^11.4.8",
"highcharts-angular": "^4.0.1",
Expand Down

0 comments on commit e4cc521

Please sign in to comment.