Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Add a bit more data and reformat the balance command (#535)
Browse files Browse the repository at this point in the history
* 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.

* Added back missing space between ask and pair
  • Loading branch information
cmroche authored and DeviaVir committed Sep 11, 2017
1 parent db6d402 commit 977d512
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions commands/balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 977d512

Please sign in to comment.