Skip to content

Commit

Permalink
bitstamp balance unified
Browse files Browse the repository at this point in the history
  • Loading branch information
kroitor committed Jul 22, 2017
1 parent 50ab7f1 commit 9c3443e
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions ccxt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3180,8 +3180,31 @@ var bitstamp = {
});
},

fetchBalance () {
return this.privatePostBalance ();
async fetchBalance () {
console.log (this.currencies)
process.exit ()
let balances = await this.privatePostBalance ();
let result = { 'info': response };
for (let c = 0; c < this.currencies.length; c++) {
let currency = this.currencies[c];
let lowercase = currency.toLowerCase ();
let total = lowercase + '_balance';
let free = lowercase + '_available';
let used = lowercase + '_reserved';
let account = {
'free': undefined,
'used': undefined,
'total': undefined,
};
if (free in balance)
account['free'] = parseFloat (balance[free]);
if (used in balance)
account['used'] = parseFloat (balance[used]);
if (total in balance)
account['total'] = parseFloat (balance[total]);
result[currency] = account;
}
return result;
},

createOrder (product, type, side, amount, price = undefined, params = {}) {
Expand Down

0 comments on commit 9c3443e

Please sign in to comment.