Migrate plugins to lib directory
This commit is contained in:
parent
09b29bba56
commit
e7ab8223c2
27 changed files with 869 additions and 858 deletions
17
lib/plugins/common/kraken.js
Normal file
17
lib/plugins/common/kraken.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
var BigNumber = require('bignumber.js')
|
||||
|
||||
var TEN = new BigNumber(10)
|
||||
|
||||
var UNIT_SCALES = {
|
||||
BTC: 8,
|
||||
ETH: 18
|
||||
}
|
||||
|
||||
function unitScale (cryptoCoin) {
|
||||
return UNIT_SCALES[cryptoCoin]
|
||||
}
|
||||
|
||||
exports.toUnit = function toUnit (cryptoAtoms, cryptoCoin) {
|
||||
var scale = TEN.pow(unitScale(cryptoCoin))
|
||||
return cryptoAtoms.div(scale)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue