You're seeing just the function new, go back to Cldr.Currency module for more information.
Link to this function

new(currency, options \\ [])

View Source


new(binary() | atom(), map() | list()) ::
  {:ok, t()} | {:error, {module(), String.t()}}

Returns a Currency struct created from the arguments.


  • currency is a private use currency code in a format defined by ISO4217 which is X followed by two alphanumeric characters.

  • options is a map of options representing the optional elements of the Cldr.Currency.t struct.


  • :name is the name of the currenct. Required.
  • :digits is the precision of the currency. Required.
  • :symbol is the currency symbol. Optional.
  • :narrow_symbol is an alternative narrow symbol. Optional.
  • :round_nearest is the rounding precision such as 0.05. Optional.
  • :alt_code is an alternative currency code for application use.
  • :cash_digits is the precision of the currency when used as cash. Optional.
  • :cash_round_nearest is the rounding precision when used as cash such as 0.05. Optional.


  • {:ok, Cldr.Currency.t} or

  • {:error, {exception, message}}


iex>, name: "XAA currency", digits: 0)
   alt_code: :XAA,
   cash_digits: 0,
   cash_rounding: nil,
   code: :XAA,
   count: %{other: "XAA currency"},
   digits: 0,
   from: nil,
   iso_digits: 0,
   name: "XAA currency",
   narrow_symbol: nil,
   rounding: 0,
   symbol: "XAA",
   tender: false,
   to: nil

{:error, {Cldr.CurrencyAlreadyDefined, "Currency :XBC is already defined."}}

iex>, name: "Private Use Name")
{:error, "Required options are missing. Required options are [:name, :digits]"}

iex>, name: "Invalid Private Use Name", digits: 0)
{:error, {Cldr.UnknownCurrencyError, "The currency :ZAA is invalid"}}