SoftBank.Cldr.Money.cross_rate-exclamation-mark

You're seeing just the function cross_rate-exclamation-mark, go back to SoftBank.Cldr.Money module for more information.
Link to this function

cross_rate!(from, to_currency, rates \\ ExchangeRates.latest_rates())

View Source

Specs

Returns the effective cross-rate to convert from one currency to another.

Arguments

  • from is any Money.t struct returned by Cldr.Currency.new/2 or a valid currency code

  • to_currency is a valid currency code into which the money is converted

  • rates is a Map of currency rates where the map key is an upcased atom or string and the value is a Decimal conversion factor. The default is the latest available exchange rates returned from Money.ExchangeRates.latest_rates()

Examples

iex> SoftBank.Cldr.Money.cross_rate!(Money.new(:USD, 100), :AUD, %{USD: Decimal.new(1), AUD: Decimal.new("0.7345")})
#Decimal<0.7345>

iex> SoftBank.Cldr.Money.cross_rate!(:USD, :AUD, %{USD: Decimal.new(1), AUD: Decimal.new("0.7345")})
#Decimal<0.7345>

SoftBank.Cldr.Money.cross_rate Money.new(:USD, 100), :ZZZ, %{USD: Decimal.new(1), AUD: Decimal.new("0.7345")}
** (Cldr.UnknownCurrencyError) Currency :ZZZ is not known