dvf-client-js
Version:
<img src="https://avatars1.githubusercontent.com/u/56512535?s=200&v=4" align="right" />
13 lines (8 loc) • 316 B
JavaScript
const getUSDPrice = require('./getUSDPrice')
module.exports = async (symbol, amount, price) => {
const quoteSymbol = symbol.split(':')[1]
quoteSymbolPrice = await getUSDPrice(quoteSymbol)
// long or short the volume will be the same
amount = Math.abs(amount)
return amount * price * quoteSymbolPrice
}