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

@ -61,7 +61,7 @@ const CRYPTO_CURRENCIES = [
}
]
module.exports = {buildUrl, cryptoDir, blockchainDir, configPath, cryptoCurrencies, getCryptoCurrency}
module.exports = {buildUrl, cryptoDir, blockchainDir, configPath, cryptoCurrencies, getCryptoCurrency, toUnit}
function getCryptoCurrency (cryptoCode) {
const cryptoCurrency = _.find(['cryptoCode', cryptoCode], CRYPTO_CURRENCIES)
@ -97,3 +97,10 @@ function cryptoDir (cryptoRec) {
function configPath (cryptoRec) {
return path.resolve(cryptoDir(cryptoRec), cryptoRec.configFile)
}
function toUnit (cryptoAtoms, cryptoCode) {
const cryptoRec = getCryptoCurrency(cryptoCode)
const unitScale = cryptoRec.unitScale
return cryptoAtoms.shift(-unitScale)
}