You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
In most cases base currency have bigger value than quote currency.
But in some situations (money order between two people with different currencies; or simply nonstandard pair where quote currency and base currency are overturned) ExchangeRate.Value is much less than 1 and loss of fraction occurs.
Maybe rounding should be more than 4 digits or to add exception if ExchangeRate.Value is less than 1 to prevent losses.
The text was updated successfully, but these errors were encountered:
The workaround for me now is
ExchangeRate exchangeRate = new ExchangeRate(baseCurrency, quoteCurrency, baseCurrencyRate / quoteCurrencyRate);
if (exchangeRate.Value < 1m)
{
exchangeRate = new ExchangeRate(quoteCurrency, baseCurrency, quoteCurrencyRate / baseCurrencyRate);
}
Good point. I was under the assumption that exchange rates are always given in 4 decimals. It looks like some exchangerateproviders provide rates for the "quote" currency up to 6 decimal places.
I think the ExchangeRate type should be changed to allow 6 decimals or even better 6 significant figures.
BTW ExchangeRate with a value of less then 1, should not be a problem in itself. Rounding of money can happen and is allowed, so far as I know.
Hi!
In most cases base currency have bigger value than quote currency.
But in some situations (money order between two people with different currencies; or simply nonstandard pair where quote currency and base currency are overturned) ExchangeRate.Value is much less than 1 and loss of fraction occurs.
Maybe rounding should be more than 4 digits or to add exception if ExchangeRate.Value is less than 1 to prevent losses.
The text was updated successfully, but these errors were encountered: