Comparing version 0.11.0 to 0.11.1
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
## 0.11.1 - 2017-09-08 | ||
- Fixes a bug that popped up in the 'funds' command when there were more than 50 coins to get a price of at the same time. | ||
## 0.11.0 - 2017-08-29 | ||
@@ -5,0 +8,0 @@ - Fixes display of funds for IOT and CH (aka IOTA and BCH). |
@@ -36,3 +36,3 @@ 'use strict'; | ||
if (program.exchange) { | ||
if (Object.keys(exchanges).indexOf(program.exchange) === -1){ | ||
if (Object.keys(exchanges).indexOf(program.exchange) === -1) { | ||
console.log(chalk.red('Unknown exchange')); | ||
@@ -49,3 +49,3 @@ process.exit(1); | ||
for (const name in config) { | ||
if (name !== 'passwordHash'){ | ||
if (name !== 'passwordHash') { | ||
exchangesToCheck.push(exchanges[name]); | ||
@@ -58,4 +58,4 @@ } | ||
let requests = exchangesToCheck.map(exchange => { | ||
return exchange.getBalances().then( balance => { | ||
if (! balance.available) { | ||
return exchange.getBalances().then(balance => { | ||
if (!balance.available) { | ||
console.log(chalk.red(capitalize(balance.market) + ' returned an error. Is your API key and secret correct?')); | ||
@@ -78,4 +78,4 @@ } | ||
Object.keys(exchange.funds).forEach(coin => { | ||
if (coin == 'CH'){ | ||
coin = 'BCH'; | ||
if (coin == 'CH') { | ||
coin = 'BCH'; | ||
} | ||
@@ -86,6 +86,25 @@ fsymbols.push(coin); | ||
}); | ||
// Cryptocompare seems to break occasionaly if > 50 symbols are sent into | ||
// priceMulti at the same time. | ||
fsymbols = _.uniq(fsymbols); | ||
return cryptocompare.priceMulti(_.uniq(fsymbols), 'USD'); | ||
var i, j, temparray, chunk = 30; | ||
let tasks = []; | ||
for (i = 0, j = fsymbols.length; i < j; i += chunk) { | ||
tasks.push(cryptocompare.priceMulti(fsymbols.slice(i, i + chunk), 'USD')); | ||
} | ||
return Promise.all(tasks).then( results => { | ||
let prices = {}; | ||
results.forEach( result => { | ||
Object.keys(result).forEach( item => { | ||
prices[item] = result[item] | ||
}); | ||
}); | ||
return prices; | ||
}); | ||
}) | ||
.then(prices => { | ||
balances.forEach(balance => { | ||
@@ -112,3 +131,3 @@ if (balance.available) { | ||
if (coins.length == 0) { | ||
if (program.exchange){ | ||
if (program.exchange) { | ||
console.log(chalk.red('Coin not found on this exchange.')); | ||
@@ -149,3 +168,3 @@ } | ||
} | ||
coins.forEach( coin => { | ||
coins.forEach(coin => { | ||
total.valueUSD += coin.valueUSD; | ||
@@ -192,3 +211,2 @@ }); | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "coinx", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "Buy and sell crypto-currencies from the command line.", | ||
@@ -5,0 +5,0 @@ "main": "coinx.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59470
1761