Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FIAT rates source explicit and selectable (enable Cryptocompare) to fix ARS rate #640

Open
eloyesp opened this issue Mar 14, 2021 · 11 comments

Comments

@eloyesp
Copy link

eloyesp commented Mar 14, 2021

Currently it seems that the source used for exchange rates was set on #159 to the Spark API, that use BitcoinAverage as source, but that is not explicit on the application and there is no setting to select another source.

The problem is that BitcoinAverage (and most other rates APIs) does not work for currencies that do not have a simple exchange rate with USD, because they only use the DASH/USD exchange rate and cross that data with FIAT/FIAT that do not work for complex cases.

Current Behavior example

Currently, DASH price is 21_356 ARS on Spark (and bitcoinAverage and CoinGecko), while CryptoCompare does get 35_259 ARS. The most correct value is the later. As you can see, the difference is not minor and makes that exchange rate unusable on the current context.

The source of the problem is that the exchange rate calculated by bitcoin average is based on the dash price of 235 USD, using an exchange rate of USD/ARS of 90.87 (what is known as the official rate), but that price is not accessible on the market, so the real value is closer to 140 ARS. You can see those different values (there are 9 different exchange rates to see) on this newspaper.

CryptoCompare does get it right because it fallback to the exchange rate of BTC/ARS so it gets a good value.

Expected Behavior

Make CryptoCompare the default source for ARS (while there might be other cases when that is a better default) and make it possible for the user to:

  1. Know the source of the data used
  2. Select a different source

I've raised the same issue on bitcoin-wallet/bitcoin-wallet#627 and I've already contacted BitcoinAverage and CoinGecko and they do not want to care about this issue.

@eloyesp eloyesp changed the title Make FIAT rates source explicit and selectable (enable Cryptocompare) Make FIAT rates source explicit and selectable (enable Cryptocompare) to fix ARS rate Mar 14, 2021
@HashEngineering
Copy link
Collaborator

Thank you for pointing this out, we will be looking into it. The app has 4 sources of exchange rates. In the past, some were depending in different ways on BitcoinAverage.com which is now behind a paywall.

Some of the sources we don't modify, while others we do some manual calculations for certain currencies. For those we don't modify, we will try to get those sources to update the ARS value to use CryptoCompare.

@AshFrancis
Copy link

AshFrancis commented Mar 15, 2021

Thank you for highlighting this Eloyesp, my team maintains one of the rate sources used in the wallet.

We had a similar issue with Venezuela due to inflation and government rates versus local rates. We can add the cryptocompare BTCARS rate as a source dependent on suitability and route all ARS pricing via DASHBTC>BTCARS but I'd also like a secondary option that is a more direct source (and fallback should we lose cryptocompare or API is prohibitive / not suitable)

From the link you provided, which USDARS source(s) do you consider the most accurate?

@eloyesp
Copy link
Author

eloyesp commented Mar 16, 2021

@AshFrancis I think that there is no more direct exchange rate than DASHBTC>BTCARS. In the link provided there are some exchange rates between USDARS, but they tend usually show a difference of 2-3% (on both directions) when inspecting the BTC->USD->ARS. The only reliable alternative source I can think on is using https://coinmonitor.info (The BTC-ARS rate "Mediana Promedio") is a good value.

@eloyesp
Copy link
Author

eloyesp commented Mar 16, 2021

I know that it might be another issue, but I also think that the API providers got a lot of usage when used on a wallet and deserve that usage to be explicit (as a kind of thanking for the service). So, if data is provided by dashretail.org, it should be shown on the wallet somewhere (at least on the about page).

@yayo8891
Copy link

Ok

@AshFrancis
Copy link

@eloyesp Both sources have been added now:

Rate
https://rates2.dashretail.org/rates?source=dashretail&symbol=dashars

In full detail:
https://rates2.dashretail.org/rates?source=dashretail&symbol=dashars&nested=1

The weight=1 on gecko for example is there for fallback reasons.

Thanks for reporting this!

@eloyesp
Copy link
Author

eloyesp commented Mar 25, 2021

The weight=1 on gecko for example is there for fallback reasons.

First thing first: "This is awesome"! Thanks!

Now, my perfectionist self found two subtle issues:

  • On one hand, there is an issue with the value extracted from coinmonitor.info, you seem to be using the value "mediana compra", that is the median of the values to "sell BTC for ARS", it would be better to use the "mediana Promedio" (that is the average between the median to sell and the median to buy)

  • On the other hand, the final value seems to be the weighted average between the average-retail (with weight 100) and the coingecko value (with weight 1), but as the coingecko value is so bad, the average get off by $110 per/DASH. It would be better to use a weight of 1000 for the average retail (I'm not sure if that is possible).

Anyway, the difference for what I hope will be normal transactions (500 ARS~17mDASH) the difference is lower than 1 mDASH, so I think that I can start promoting DASH here with this working as is, if it is too hard to fix.

Thanks @AshFrancis .

@HashEngineering
Copy link
Collaborator

@eloyesp @AshFrancis
This issue appears to be resolved.

@eloyesp
Copy link
Author

eloyesp commented Aug 9, 2021

This issue appears to be resolved.

@HashEngineering While an interesting point is already there (ARS exchange rate is much better), most of the issues I mentioned are not fixed.

  • Make rates source explicit, as the user deserves to know who he is trusting and the source deserve the credit.
  • Make the source configurable, so the user can select a better (more trusted) source.

Maybe I should create a different issue to follow those or I may help somehow?


Also, the price for ARS seems to have changed again on dashretail (as it seems to add more weight to the official exchange between USD-ARS).

So, currently, cryptocompare price is estimation is: 30253.75 ARS while dashretail estimates 20958.52 ARS. @AshFrancis

The cryptocompare price can be obtained with a GET here: https://min-api.cryptocompare.com/data/price?fsym=DASH&tsyms=ARS

@HashEngineering
Copy link
Collaborator

What is meant by making rates source explicit and configurable?

@eloyesp
Copy link
Author

eloyesp commented Aug 9, 2021

Making source rates explicit is just adding a message somewhere on the application indicating that, for example:

image

For the config, something bellow the option to chose the Local Currency:

image

That way, the user knows what is the source being used (that he needs to trust), and can select an alternative source (that he and the local comunity trust).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants