diff --git a/Makefile b/Makefile index c2ea591a1..2665fe31c 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ K ?= K.sh MAJOR = 0 MINOR = 6 PATCH = 4 -BUILD = 21 +BUILD = 22 OBLIGATORY = DISCLAIMER: This is strict non-violent software: \n$\ if you hurt other living creatures, please stop; \n$\ diff --git a/src/bin/+portfolios/+portfolios.client/Wallets.ts b/src/bin/+portfolios/+portfolios.client/Wallets.ts index a9ff0f183..faed049ad 100644 --- a/src/bin/+portfolios/+portfolios.client/Wallets.ts +++ b/src/bin/+portfolios/+portfolios.client/Wallets.ts @@ -226,7 +226,6 @@ export class WalletsComponent { private addRowData = (o: any) => { if (!this.grid.api) return; var sum = 0; - var pin_sum = document.getElementById('balance_pin'); if (o === null) { this.grid.api.setRowData([]); this.selection = null; @@ -257,20 +256,24 @@ export class WalletsComponent { .concat(Shared.resetRowData('held', held, node)) .concat(Shared.resetRowData('total', total, node)) }); + }); + this.grid.api.onFilterChanged(); - if (!this.grid.api.getSelectedNodes().length) - this.grid.api.onSortChanged(); + if (!this.grid.api.getSelectedNodes().length) + this.grid.api.onSortChanged(); - if (pin_sum) { - var el = document.getElementById('balance_percent_' + o.wallet.currency); + var pin_sum = document.getElementById('balance_pin'); + if (pin_sum) { + pin_sum.innerHTML = Shared.str(sum, 8); + + this.grid.api.forEachNode((node: RowNode) => { + var el = document.getElementById('balance_percent_' + node.data.currency); if (el) { - var val = Shared.str(o.wallet.value / Shared.num(pin_sum.innerHTML) * 100, 2); + var val = Shared.str(Shared.num(node.data.balance) / sum * 100, 2); if (val != el.innerHTML) el.innerHTML = val; } - } - }); - - if (pin_sum) pin_sum.innerHTML = Shared.str(sum, 8); + }); + } }; }; diff --git a/src/bin/scaling-bot/scaling-bot.data.h b/src/bin/scaling-bot/scaling-bot.data.h index 6b2d1416d..ed7f662fb 100644 --- a/src/bin/scaling-bot/scaling-bot.data.h +++ b/src/bin/scaling-bot/scaling-bot.data.h @@ -310,9 +310,11 @@ namespace analpaper { void debug(const string &step) { if (K.arg("debug-quotes")) K.log("DEBUG QE", "[" + step + "] " - + to_string((int)bid.state) + ":" - + to_string((int)ask.state) + " " - + ((json){{"bid", bid}, {"ask", ask}}).dump() + + to_string((int)ask.state) + ":" + + to_string((int)bid.state) + " " + + to_string((int)ask.isPong) + ":" + + to_string((int)bid.isPong) + " " + + ((json){{"ask", ask}, {"bid", bid}}).dump() ); }; }; @@ -367,6 +369,8 @@ namespace analpaper { return true; }; void calcRawQuotes() { + quotes.ask.isPong = + quotes.bid.isPong = false; quotes.bid.size = quotes.ask.size = K.arg("order-size"); quotes.bid.price = fmin( diff --git a/src/bin/stable--bot/stable--bot.data.h b/src/bin/stable--bot/stable--bot.data.h index a909f6efc..556339eb3 100644 --- a/src/bin/stable--bot/stable--bot.data.h +++ b/src/bin/stable--bot/stable--bot.data.h @@ -258,9 +258,11 @@ namespace analpaper { void debug(const string &step) { if (K.arg("debug-quotes")) K.log("DEBUG QE", "[" + step + "] " - + to_string((int)bid.state) + ":" - + to_string((int)ask.state) + " " - + ((json){{"bid", bid}, {"ask", ask}}).dump() + + to_string((int)ask.state) + ":" + + to_string((int)bid.state) + " " + + to_string((int)ask.isPong) + ":" + + to_string((int)bid.isPong) + " " + + ((json){{"ask", ask}, {"bid", bid}}).dump() ); }; }; diff --git a/src/bin/trading-bot/trading-bot.data.h b/src/bin/trading-bot/trading-bot.data.h index df35a31dd..5dc9fe5e9 100644 --- a/src/bin/trading-bot/trading-bot.data.h +++ b/src/bin/trading-bot/trading-bot.data.h @@ -1973,11 +1973,11 @@ namespace tribeca { void debug(const string &step) { if (K.arg("debug-quotes")) K.log("DEBUG QE", "[" + step + "] " - + to_string((int)bid.state) + ":" - + to_string((int)ask.state) + " " - + to_string((int)bid.isPong) + ":" - + to_string((int)ask.isPong) + " " - + ((json){{"bid", bid}, {"ask", ask}}).dump() + + to_string((int)ask.state) + ":" + + to_string((int)bid.state) + " " + + to_string((int)ask.isPong) + ":" + + to_string((int)bid.isPong) + " " + + ((json){{"ask", ask}, {"bid", bid}}).dump() ); }; }; @@ -2528,30 +2528,22 @@ namespace tribeca { } }; void applyDepleted() { - if (!quotes.bid.empty()) { - const Amount minBid = K.gateway->minValue - ? fmax(K.gateway->minSize, K.gateway->minValue / quotes.bid.price) - : K.gateway->minSize; + if (!quotes.bid.empty()) if ((K.gateway->margin == Future::Spot ? wallet.quote.total / quotes.bid.price : (K.gateway->margin == Future::Inverse ? wallet.base.amount * quotes.bid.price : wallet.base.amount / quotes.bid.price) - ) < minBid + ) < quotes.bid.size ) quotes.bid.clear(QuoteState::DepletedFunds); - } - if (!quotes.ask.empty()) { - const Amount minAsk = K.gateway->minValue - ? fmax(K.gateway->minSize, K.gateway->minValue / quotes.ask.price) - : K.gateway->minSize; + if (!quotes.ask.empty()) if ((K.gateway->margin == Future::Spot ? wallet.base.total : (K.gateway->margin == Future::Inverse ? wallet.base.amount * quotes.ask.price : wallet.base.amount / quotes.ask.price) - ) < minAsk + ) < quotes.ask.size ) quotes.ask.clear(QuoteState::DepletedFunds); - } }; void applyWaitingPing() { if (qp.safety == QuotingSafety::Off) return;