I've got an API that returns the value of USD/Bitcoin & USD/GBP.
{"USDBITCOIN":"4251.27", "USDGBP":"0.758659"}
To calculate the exchange rate of GBP/Bitcoin, I simply divide the value of the GBP by Bitcoin, because they are both USD based.
How would calculate the exchange rate of Bitcoin/GBP? It may be really simple, but it's really baffling me. I've got the below to calculate
app.js
xOfy(unit, value) { return unit / value; } yOfX(unit, value) { return unit * value; } xOfy(gbp, bitcoin) // 0.00018 yOfx(bitcoin, gbp) // 3225.26