diff --git a/package-lock.json b/package-lock.json index c987e07..bf1823f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "bitstamp-exc", - "version": "2.1.6", + "version": "2.1.7", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -95,9 +95,9 @@ } }, "@coinify/currency": { - "version": "1.3.38", - "resolved": "https://registry.npmjs.org/@coinify/currency/-/currency-1.3.38.tgz", - "integrity": "sha512-//39QQuVeiYtuKWyUz/1IhtYjHpha4k4xEtAlhwB+mQ+MZNB/70nC5OOlJjAvk6DFjDiIlX2fdjkCLZnp7H0zA==", + "version": "1.4.12", + "resolved": "https://registry.npmjs.org/@coinify/currency/-/currency-1.4.12.tgz", + "integrity": "sha512-AXtQ7Etzb4WS2/4lOEP1m5T6B805vy/DyUgPp02CVjG6dyUCD6fLDHP6QZ1UXxgZGFuoVnFOC9Lcv4VqY6YjJg==", "requires": { "lodash": "^4.17.21" } diff --git a/package.json b/package.json index 5e9ee8e..20797ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitstamp-exc", - "version": "2.1.6", + "version": "2.1.7", "description": "An NPM package for utilizing the Bitstamp exchange API", "main": "index.js", "scripts": { @@ -25,7 +25,7 @@ "typescript": "^4.4.4" }, "dependencies": { - "@coinify/currency": "^1.3.38", + "@coinify/currency": "^1.4.12", "async": "^2.6.4", "axios": "^0.24.0", "console-log-level": "^1.4.1", diff --git a/test/integration/getOrderBook.test.js b/test/integration/getOrderBook.test.js index 8b28cf1..1ba5fb9 100644 --- a/test/integration/getOrderBook.test.js +++ b/test/integration/getOrderBook.test.js @@ -22,8 +22,7 @@ describe('#getOrderBook', () => { { baseCurrency: 'BTC', quoteCurrency: 'USD', bitstampSymbol: 'btcusd' }, { baseCurrency: 'BTC', quoteCurrency: 'EUR', bitstampSymbol: 'btceur' }, { baseCurrency: 'BCH', quoteCurrency: 'USD', bitstampSymbol: 'bchusd' }, - { baseCurrency: 'BCH', quoteCurrency: 'EUR', bitstampSymbol: 'bcheur' }, - { baseCurrency: 'ALGO', quoteCurrency: 'USD', bitstampSymbol: 'algousd' } + { baseCurrency: 'BCH', quoteCurrency: 'EUR', bitstampSymbol: 'bcheur' } ].forEach(({ baseCurrency, quoteCurrency, bitstampSymbol }) => { it(`should get and return order book for ${baseCurrency}/${quoteCurrency}`, async () => { requestStub.resolves({ data: responses.getOrderBookResponseBTC }); @@ -125,6 +124,31 @@ describe('#getOrderBook', () => { }); }); + [ + { baseCurrency: 'ALGO', quoteCurrency: 'USD', bitstampSymbol: 'algousd' } + ].forEach(({ baseCurrency, quoteCurrency, bitstampSymbol }) => { + it(`should get and return order book for ${baseCurrency}/${quoteCurrency} 6 decimals precision`, async () => { + requestStub.resolves({ data: responses.getOrderBookResponseUSDC }); + const res = await promisify(bitstamp.getOrderBook.bind(bitstamp))(baseCurrency, quoteCurrency); + + expect(res).to.deep.equal({ + baseCurrency, + quoteCurrency, + bids: [ + { price: 0.99997, baseAmount: 49712059620 }, + { price: 0.99995, baseAmount: 50002500060 } + ], + asks: [ + { price: 1, baseAmount: 40987234120 }, + { price: 1.00001, baseAmount: 114975960850 } + ] + }); + + expect(requestStub.calledOnce).to.equal(true); + expect(requestStub.firstCall.args[0]).to.equal(`/api/v2/order_book/${bitstampSymbol}/`); + }); + }); + it('should throw err if currency pair is not supported', (done) => { const baseCurrency = 'XMR'; const quoteCurrency = 'USD';