Skip to content

Commit

Permalink
Fixed latency for orders loaded from other bots.
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 <[email protected]>
 _________________________________________
/ Hello, WORLD!                           \
|                                         |
\ pssst.. 1.00000000 BTC = 56830.99 EUR.  /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
  • Loading branch information
ctubio committed Oct 9, 2024
1 parent ba37200 commit b3dfb77
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 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 = 33
BUILD = 34

OBLIGATORY = DISCLAIMER: This is strict non-violent software: \n$\
if you hurt other living creatures, please stop; \n$\
Expand Down
8 changes: 4 additions & 4 deletions src/bin/+portfolios/+portfolios.client/Orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ export class OrdersComponent {
'buy': 'data.side == "Bid"'
},
cellRenderer: (params) => (
params.data.pong
? '&#10564;'
: '&#10140;'
params.value == "Ask"
? '<span style="transform: rotate(180deg);display: inline-block;">&#10140;</span>'
: '<span style="display: inline-block;">&#10140;</span>'
) + params.value
}, {
width: 74,
Expand Down Expand Up @@ -206,7 +206,7 @@ export class OrdersComponent {
value: (Math.round(o.quantity * o.price * 100) / 100), //.toFixed(this.product.tickPrice)
type: Models.OrderType[o.type],
tif: Models.TimeInForce[o.timeInForce],
lat: o.latency ? o.latency + 'ms' : 'loaded',
lat: o.latency < 0 ? 'loaded' : o.latency + 'ms',
quantity: o.quantity, //.toFixed(this.product.tickSize)
pong: o.isPong,
time: o.time
Expand Down
11 changes: 6 additions & 5 deletions src/lib/Krypto.ninja-bots.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ namespace ₿ {
};
private:
string lines(string reason) const {
string::size_type n = 0;
size_t n = 0;
while ((n = reason.find(ANSI_NEW_LINE, n + 2)) != string::npos)
reason.insert(n + 2, ANSI_HIGH_RED);
return ANSI_HIGH_RED + reason;
Expand All @@ -282,7 +282,7 @@ namespace ₿ {
clog << puke;
#endif
if (display.terminal) {
string::size_type n = 0;
size_t n = 0;
while ((n = puke.find(ANSI_NEW_LINE)) != string::npos) {
clogs.emplace_back(puke.begin(), puke.begin() + n);
puke.erase(0, n + 2);
Expand Down Expand Up @@ -502,7 +502,7 @@ namespace ₿ {
args["base"] = arg<string>("currency").substr(0, arg<string>("currency").find("/"));
args["quote"] = arg<string>("currency").substr(1+ arg<string>("currency").find("/"));
if (arg<string>("secret").find("EC PRIVATE KEY") != string::npos and arg<string>("secret").find(ANSI_NEW_LINE) == string::npos) {
string::size_type n = 0;
size_t n = 0;
while ((n = arg<string>("secret").find("\\r", n)) != string::npos)
args["secret"] = string(arg<string>("secret")).erase(n, 2);
n = 0;
Expand Down Expand Up @@ -600,7 +600,7 @@ namespace ₿ {
<< it.name
<< string((11 - it.name.length()) / 2, ' ') << " █▓▒░";
else {
string::size_type n = 0;
size_t n = 0;
while ((n = usage.find(ANSI_NEW_LINE, n + 2)) != string::npos)
usage.insert(n + 2, 28, ' ');
const string example = "--" + it.name + (it.default_value ? "=" + it.defined_value : "");
Expand Down Expand Up @@ -1450,7 +1450,8 @@ namespace ₿ {
Order *found = find(raw.orderId);
if (!found and withExternal and raw.status == Status::Working) {
Order external = raw;
external.status = Status::Waiting;
external.status = Status::Waiting;
external.latency = -1;
found = findsert(external);
}
return found;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Krypto.ninja-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ export define PACKAGE_JSON
"@angular/platform-browser-dynamic": "^18.2.7",
"@angular/router": "^18.2.7",
"@types/node": "^22.7.4",
"ag-grid-angular": "^32.2.1",
"ag-grid-community": "^32.2.1",
"ag-grid-angular": "^32.2.2",
"ag-grid-community": "^32.2.2",
"esbuild": "^0.24.0",
"highcharts": "^11.4.8",
"highcharts-angular": "^4.0.1",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Krypto.ninja-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ namespace ₿ {
BIO_get_mem_ptr(bio.get(), &buf);
string output(buf->data, buf->length);
if (urlsafe) {
string::size_type n = 0;
size_t n = 0;
while ((n = output.find("+")) != string::npos)
output.replace(n, 1, "-");
while ((n = output.find("/")) != string::npos)
Expand All @@ -774,7 +774,7 @@ namespace ₿ {
static string B64_decode(const string &input, const bool &urlsafe = false) {
if (urlsafe) {
string output = input;
string::size_type n = 0;
size_t n = 0;
while ((n = output.find("-")) != string::npos)
output.replace(n, 1, "+");
while ((n = output.find("_")) != string::npos)
Expand Down Expand Up @@ -1392,7 +1392,7 @@ namespace ₿ {
class Files {
public:
static bool mkdirs(const string &file) {
string::size_type has_dir = file.find_last_of("/\\");
size_t has_dir = file.find_last_of("/\\");
if (has_dir != string::npos) {
string dir = file.substr(0, has_dir);
if (access(dir.data(), R_OK) == -1) {
Expand Down

0 comments on commit b3dfb77

Please sign in to comment.