Fixed bitstamp coin scaling (#167)

The coin scaling for the bistamp excahnge was using a satoshi scaling for ETH when it should have been using wei.
This commit is contained in:
Rafael Taranto 2018-09-19 12:56:22 -03:00 committed by Josh Harvey
parent 38aa006ecc
commit de4a675a43
4 changed files with 13 additions and 14 deletions

View file

@ -1,6 +1,5 @@
const common = require('../../common/bitstamp')
const SATOSHI_SHIFT = 8
const coinUtils = require('../../../coin-utils')
function buy (account, cryptoAtoms, fiatCode, cryptoCode) {
return trade('buy', account, cryptoAtoms, fiatCode, cryptoCode)
@ -27,7 +26,7 @@ function trade (type, account, cryptoAtoms, _fiatCode, cryptoCode) {
try {
const market = common.buildMarket(fiatCode, cryptoCode)
const options = {amount: cryptoAtoms.shift(-SATOSHI_SHIFT).toFixed(8)}
const options = {amount: coinUtils.toUnit(cryptoAtoms, cryptoCode).toFixed(8)}
return common.authRequest(account, '/' + type + '/market/' + market, options)
.catch(e => {