ACINQ / phoenix

Phoenix is a self-custodial Bitcoin wallet using Lightning to send/receive payments.
https://phoenix.acinq.co
Apache License 2.0
656 stars 97 forks source link

Prioritise free market exchanges rates over official ones #390

Closed dpad85 closed 1 year ago

dpad85 commented 1 year ago

Some currencies have two rates, the official rate (whose value is decided unilaterally usually by a state body) and the free market rate. The free market one should take precedence over the official rate, as it is the rate that is commonly used.

We could remove the official rate altogether, but it may still be useful to have some reference in the app.

@robbiehanson I've added new attributes in the FiatCurrency object because it makes sense to share data as much as possible. If it's an issue (for example, the flag code in Swift), we can revert that.

new displayCode in FiatCurrency

It helps decoupling the internal API code from the actual ticker displayed in the UI. For example, we want to keep using the ARS code internally for the official ARS rate. That way we don't break the data in the app database, and we don't break the code fetching the rate from the coinbase API. But the UI uses a different ticker, in this case ARS_OFF to show that it's the official rate and not the Blue Market one.

Conversely, for the Blue Market rate, we keep using ARS_BM internally, but in the Android UI I now use displayCode which prints ARS.

Let me know what you think.


Note: As usual there's a separate commit for the changes in the phoenix-shared module, and another commit that's only about phoenix-android and that you can disregard.