From ca1fe411be2661ef8c1a2abcb34a15772d459596 Mon Sep 17 00:00:00 2001 From: Genar Trias Ortiz Date: Thu, 7 Dec 2017 18:07:17 +0100 Subject: [PATCH] Fixing summaries api call, refs #7 --- package.json | 2 +- server/exchanges/bittrex.js | 9 ++++++++- server/exchanges/bittrex.spec.js | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 server/exchanges/bittrex.spec.js diff --git a/package.json b/package.json index 41b0640..b136cc0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "babel-node": "babel-node server/server.js", "nodemon": "nodemon --exec npm run babel-node", "start": "node .", - "dev": "DEBUG=gaby-api* NODE_ENV=development DB_HOST=localhost npm run nodemon", + "dev": "DEBUG=goby-api* NODE_ENV=development DB_HOST=localhost npm run nodemon", "ci-test": "NODE_ENV=test npm test -- --no-color", "test": "node scripts/test.js", "posttest": "npm run lint && nsp check", diff --git a/server/exchanges/bittrex.js b/server/exchanges/bittrex.js index ec7d38a..5a241f3 100644 --- a/server/exchanges/bittrex.js +++ b/server/exchanges/bittrex.js @@ -3,6 +3,9 @@ import debug from 'debug' module.exports = class BittrexExchange { constructor (bitrexOpts) { + this.marketBlacklist = [ + 'BTC' + ] this.bittrexOps = bitrexOpts bittrex.options(bitrexOpts) } @@ -25,7 +28,7 @@ module.exports = class BittrexExchange { bittrex.getorderhistory(options, function (data, err) { if (err) { - debug('goby-api:bittrex')('An error getting orderhistory happened') + debug('goby-api:bittrex')('An error getting orderhistory happened for market: ', market) return cb(err) } @@ -63,6 +66,10 @@ module.exports = class BittrexExchange { const orderHistories = [] balances.forEach((balance) => { + if (this.marketBlacklist.indexOf(balance.Currency) !== -1) { + return + } + const balanceSummary = new Promise((resolve, reject) => { const market = 'BTC-' + balance.Currency this.getOrders(market, (err, data) => { diff --git a/server/exchanges/bittrex.spec.js b/server/exchanges/bittrex.spec.js new file mode 100644 index 0000000..226ae2a --- /dev/null +++ b/server/exchanges/bittrex.spec.js @@ -0,0 +1,7 @@ +describe('exchanges', () => { + describe('bittrex', () => { + it('should bla bla', (done) => { + done() + }) + }) +})