lamassu-server/lib/plugins/common/kraken.js
2017-06-24 01:33:10 +03:00

27 lines
471 B
JavaScript

const BigNumber = require('bignumber.js')
const coinUtils = require('../../coin-utils')
const TEN = new BigNumber(10)
const PAIRS = {
BTC: {
USD: 'XXBTZUSD',
EUR: 'XXBTZEUR'
},
ETH: {
USD: 'XETHZUSD',
EUR: 'XETHZEUR'
},
ZEC: {
USD: 'XZECZUSD',
EUR: 'XZECZEUR'
}
}
module.exports = {PAIRS, toUnit}
function toUnit (cryptoAtoms, cryptoCoin) {
var scale = TEN.pow(coinUtils.unitScale(cryptoCoin))
return cryptoAtoms.div(scale)
}