Created
May 1, 2018 01:39
-
-
Save libasoles/0029123e4e459e25fc1dff93d5343901 to your computer and use it in GitHub Desktop.
Consulta de balances en cryptomkt usando api interna
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cryptoapi = (()=>{ | |
function getBalance(currency = 'ARS') { | |
return window.balances.find(x=> x.currency_name === currency) | |
} | |
function getAvailableBalance(currency = 'ARS') { | |
return parseFloat(getBalance(currency).disponible).toFixed(2); | |
} | |
return { | |
getBalance: getBalance, | |
getAvailableBalance: getAvailableBalance | |
} | |
})() | |
const balanceARS = cryptoapi.getBalance('ARS') | |
console.log(balanceARS.disponible) | |
const balanceXLM = cryptoapi.getAvailableBalance('XLM') | |
console.log(balanceXLM) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment