Amount and Commodity Functions =============================== .. py:type:: amount An amount is a value with a currency/commodity. Examples: ``10.50 USD``, ``5 HOOL``. **Commodities** (synonymous to **currencies**) are not represented by their own type but are simply stated as all-caps :type:`strings`. An amount is wrapped in a :type:`position` when it is registered in an account, potentially with the original cost attached. Amounts can be :func:`summed` up, resulting in :type:`inventories` The following functions are available that involve amounts and currencies: * :func:`~fun.bool` - Convert to bool value. * :func:`~fun.commodity` - Extract the currency from an Amount. * :func:`~fun.commodity_meta` - Get the metadata dict of the commodity directive of the currency. * :func:`~fun.convert` - Coerce an amount to a particular currency. * :func:`~fun.currency` - Extract the currency from an Amount. * :func:`~fun.currency_meta` - Get the metadata dict of the commodity directive of the currency. * :func:`~fun.neg` - Negative value. * :func:`~fun.number` - Extract the number from an Amount. * :func:`~fun.only` - Get one currency's amount from the inventory. * :func:`~fun.possign` - Correct sign of an Amount based on the usual balance of associated account. * :func:`~fun.repr` - Convert the argument to a string via repr(). * :func:`~fun.str` - Convert any object to a string.