Firstly we obtain the bid and ask prices for both the currency pair being traded as well as the “quote/home” currency pair. For instance, for an account denominated in GBP, where we are trading EUR/USD, we must obtain prices for “USD/GBP”, since EUR is the base currency and USD is the quote.
So if I have a currency pair like this GBP_USD, where bid=1.5750 and ask=1.5752. How do I calculate the USD_GBP? I don’t think I could obtain that from Oanda API, right?
The relationship between the British Pound and the US Dollar is conventionally always quoted in terms of GBP/USD (and widely referred to for historical reasons as “Cable”).
To derive the USD/GBP relationship from any GBP/USD price, one simply needs to take its reciprocal by diving the figure into 1.0.
So the bid of 1.5750 would be 0.63492 (1/1.575) and the ask of 1.5752 would be 0.63484 (1/1.5752).
In one case one is selling Dollars and buying Pounds, and in the other, the opposite: so the two figures are just reciprocals of each other.