UNPKG

efx-api-node

Version:

<img src="https://avatars3.githubusercontent.com/u/33315316?s=200&v=4" align="right" />

13 lines (9 loc) 369 B
const getUSDPrice = require('./getUSDPrice') module.exports = async (symbol, amount, price) => { const baseSymbol = symbol.substr(0, symbol.length - 3) const quoteSymbol = symbol.substr(-3) quoteSymbolPrice = await getUSDPrice(quoteSymbol) // long or short the volume will be the same amount = Math.abs(amount) return amount * price * quoteSymbolPrice }