From 584c68953c9429581b05331fda4a04c44dd00a53 Mon Sep 17 00:00:00 2001 From: Clifford Roche Date: Sun, 10 Sep 2017 16:56:40 -0400 Subject: [PATCH 1/2] Add a bit more data and reformat the balance command This allows us to see the available balance, handy when you want to make manual trades. --- commands/balance.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/commands/balance.js b/commands/balance.js index d95715f1e3..a6edf325d7 100644 --- a/commands/balance.js +++ b/commands/balance.js @@ -36,10 +36,13 @@ module.exports = function container (get, set, clear) { if (err) return cb(err) s.exchange.getQuote(s, function (err, quote) { if (err) throw err - var bal = moment().format('YYYY-MM-DD HH:mm:ss').grey + ' ' + engine.formatCurrency(quote.ask, true, true, false) - bal += ' ' + (s.product_id + ' Asset: ').grey + balance.asset.white + ' Currency: '.grey + balance.currency.yellow + ' Total: '.grey + n(balance.asset).multiply(quote.ask).add(balance.currency).value().toString().yellow + + var bal = moment().format('YYYY-MM-DD HH:mm:ss').grey + ' ' + engine.formatCurrency(quote.ask, true, true, false) + (s.product_id).grey + '\n' + bal += moment().format('YYYY-MM-DD HH:mm:ss').grey + ' Asset: '.grey + balance.asset.white + ' Available: '.grey + n(balance.asset).subtract(balance.asset_hold).value().toString().yellow + '\n' + bal += moment().format('YYYY-MM-DD HH:mm:ss').grey + ' Currency: '.grey + balance.currency.white + ' Available: '.grey + n(balance.currency).subtract(balance.currency_hold).value().toString().yellow + '\n' + bal += moment().format('YYYY-MM-DD HH:mm:ss').grey + ' Total: '.grey + n(balance.asset).multiply(quote.ask).add(balance.currency).value().toString().white console.log(bal) - + if (so.calculate_currency) { s.exchange.getQuote({'product_id': s.asset + '-' + so.calculate_currency}, function (err, asset_quote) { if (err) throw err From 3d55dee449b090f032d397208497562be58499c4 Mon Sep 17 00:00:00 2001 From: Clifford Roche Date: Sun, 10 Sep 2017 17:28:28 -0400 Subject: [PATCH 2/2] Added back missing space between ask and pair --- commands/balance.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/balance.js b/commands/balance.js index a6edf325d7..48f0d896a5 100644 --- a/commands/balance.js +++ b/commands/balance.js @@ -37,7 +37,7 @@ module.exports = function container (get, set, clear) { s.exchange.getQuote(s, function (err, quote) { if (err) throw err - var bal = moment().format('YYYY-MM-DD HH:mm:ss').grey + ' ' + engine.formatCurrency(quote.ask, true, true, false) + (s.product_id).grey + '\n' + var bal = moment().format('YYYY-MM-DD HH:mm:ss').grey + ' ' + engine.formatCurrency(quote.ask, true, true, false) + ' ' + (s.product_id).grey + '\n' bal += moment().format('YYYY-MM-DD HH:mm:ss').grey + ' Asset: '.grey + balance.asset.white + ' Available: '.grey + n(balance.asset).subtract(balance.asset_hold).value().toString().yellow + '\n' bal += moment().format('YYYY-MM-DD HH:mm:ss').grey + ' Currency: '.grey + balance.currency.white + ' Available: '.grey + n(balance.currency).subtract(balance.currency_hold).value().toString().yellow + '\n' bal += moment().format('YYYY-MM-DD HH:mm:ss').grey + ' Total: '.grey + n(balance.asset).multiply(quote.ask).add(balance.currency).value().toString().white