Liking cljdoc? Tell your friends :D

clojurewerkz.money.amounts

Operations on monetary amounts, including conversion, parsing, and predicates

Operations on monetary amounts, including conversion, parsing, and predicates
raw docstring

<clj

(< a)
(< a b)
(< a b & more)

Returns true if the given money amounts are in monotonically decreasing order, otherwise false.

Returns true if the given money amounts are in monotonically decreasing order,
otherwise false.
sourceraw docstring

<=clj

(<= a)
(<= a b)
(<= a b & more)

Returns true if the given money amounts are in monotonically non-decreasing order, otherwise false.

Returns true if the given money amounts are in monotonically non-decreasing order,
otherwise false.
sourceraw docstring

>clj

(> a)
(> a b)
(> a b & more)

Returns true if the given money amounts are in monotonically decreasing order, otherwise false.

Returns true if the given money amounts are in monotonically decreasing order,
otherwise false.
sourceraw docstring

>=clj

(>= a)
(>= a b)
(>= a b & more)

Returns true if the given money amounts are in monotonically non-increasing order, otherwise false.

Returns true if the given money amounts are in monotonically non-increasing order,
otherwise false.
sourceraw docstring

absclj

(abs money)

Takes absolute value of the given monetary amount

Takes absolute value of the given monetary amount
sourceraw docstring

amount-ofclj

(amount-of unit amount)
(amount-of unit amount rm)

Instantiates a monetary amount of given currency unit and amount as double. N.B. this function should not be used for currencies without minor units (e.g. JPY).

Instantiates a monetary amount of given currency unit and amount as double.
N.B. this function should not be used for currencies without minor units (e.g. JPY).
sourceraw docstring

AmountOpscljprotocol

op-divideclj

(op-divide multiplier money rounding-mode)

op-minusclj

(op-minus other money rounding-mode)

op-multiplyclj

(op-multiply multiplier money rounding-mode)

op-plusclj

(op-plus other money rounding-mode)
source

convert-toclj

(convert-to money currency multiplier rounding-mode)

Converts monetary amount in one currency to monetary amount in a different currency using the provided multiplier (exchange rate) and rounding mode.

Multiplier should be either a java.math.BigDecimal or a double.

Rounding mode should be one of:

  • java.math.RoundingMode instances
  • :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names
  • nil for no rounding
Converts monetary amount in one currency to monetary amount in a different
currency using the provided multiplier (exchange rate) and rounding mode.

Multiplier should be either a java.math.BigDecimal or a double.

Rounding mode should be one of:

* java.math.RoundingMode instances
* :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to
  java.math.RoundingMode constants with the same names
* nil for no rounding
sourceraw docstring

currency-ofclj

(currency-of money)

Returns the currency of a monetary amount

Returns the currency of a monetary amount
sourceraw docstring

divideclj

(divide money multiplier)
(divide money multiplier rounding-mode)

Divides monetary amount by the given number. Takes an optional arounding mode which is one of:

  • java.math.RoundingMode instances
  • :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names
  • nil for no rounding
Divides monetary amount by the given number. Takes an optional arounding
mode which is one of:

* java.math.RoundingMode instances
* :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to
  java.math.RoundingMode constants with the same names
* nil for no rounding
sourceraw docstring

major-ofclj

(major-of money)

Returns the amount in major units as a long

Returns the amount in major units as a long
sourceraw docstring

maxclj

(max a)
(max a b)
(max a b & more)

Returns the greatest of the given money amounts

Returns the greatest of the given money amounts
sourceraw docstring

minclj

(min a)
(min a b)
(min a b & more)

Returns the least of the given money amounts

Returns the least of the given money amounts
sourceraw docstring

minor-ofclj

(minor-of money)

Returns the amount in minor units as a BigInt

Returns the amount in minor units as a BigInt
sourceraw docstring

minusclj

(minus money other)

Subtracts one monetary amount from another, taking one of them in major units (e.g. dollars)

Subtracts one monetary amount from another, taking one of them in
major units (e.g. dollars)
sourceraw docstring

minus-majorclj

(minus-major money amount)

Subtracts one monetary amount from another, taking one of them in minor units (e.g. cents)

Subtracts one monetary amount from another, taking one of them in
minor units (e.g. cents)
sourceraw docstring

minus-minorclj

(minus-minor money amount)

Subtracts one monetary amount from another

Subtracts one monetary amount from another
sourceraw docstring

multiplyclj

(multiply money multiplier)
(multiply money multiplier rounding-mode)

Multiplies monetary amount by the given number. Takes an optional arounding mode which is one of:

  • java.math.RoundingMode instances
  • :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names
  • nil for no rounding
Multiplies monetary amount by the given number. Takes an optional arounding
mode which is one of:

* java.math.RoundingMode instances
* :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to
  java.math.RoundingMode constants with the same names
* nil for no rounding
sourceraw docstring

negatedclj

(negated money)

Negates the given monetary amount

Negates the given monetary amount
sourceraw docstring

negative-or-zero?clj

(negative-or-zero? money)

Returns true if the given monetary amount is negative or zero

Returns true if the given monetary amount is negative or zero
sourceraw docstring

negative?clj

(negative? money)

Returns true if the given monetary amount is negative

Returns true if the given monetary amount is negative
sourceraw docstring

of-majorclj

(of-major unit amount)

Instantiates a monetary amount of given currency unit and major unit amount. This function should be used for currencies without minor units (e.g. JPY).

Instantiates a monetary amount of given currency unit and major unit amount.
This function should be used for currencies without minor units (e.g. JPY).
sourceraw docstring

of-minorclj

(of-minor unit amount)

Instantiates a monetary amount of given currency unit and minor unit amount. This function can be used for currencies without minor units (e.g. JPY), in which case it's going to work just as of-major.

Instantiates a monetary amount of given currency unit and minor unit amount.
This function can be used for currencies without minor units (e.g. JPY),
in which case it's going to work just as of-major.
sourceraw docstring

parseclj

(parse s)

Parses a string in the format of [currency code] [amount as double] (e.g. GBP 20.00) and returns a monetary amount.

Parses a string in the format of [currency code] [amount as double]
(e.g. GBP 20.00) and returns a monetary amount.
sourceraw docstring

plusclj

(plus money other)

Adds two monetary amounts together

Adds two monetary amounts together
sourceraw docstring

plus-majorclj

(plus-major money amount)

Adds two monetary amounts together, taking one of them in major units (e.g. dollars)

Adds two monetary amounts together, taking one of them in
major units (e.g. dollars)
sourceraw docstring

plus-minorclj

(plus-minor money amount)

Adds two monetary amounts together, taking one of them in minor units (e.g. cents)

Adds two monetary amounts together, taking one of them in
minor units (e.g. cents)
sourceraw docstring

positive-or-zero?clj

(positive-or-zero? money)

Returns true if the given monetary amount is positive or zero

Returns true if the given monetary amount is positive or zero
sourceraw docstring

positive?clj

(positive? money)

Returns true if the given monetary amount is positive

Returns true if the given monetary amount is positive
sourceraw docstring

roundclj

(round money scale rounding-mode)

Rounds monetary amount using the given scale and rounding mode.

Scale is one of -1, 0, 1, 2, 3 but no greater than the currency's scale.

Rounding mode should be one of:

  • java.math.RoundingMode instances
  • :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names
  • nil for no rounding
Rounds monetary amount using the given scale and rounding mode.

Scale is one of -1, 0, 1, 2, 3 but no greater than the currency's scale.

Rounding mode should be one of:

* java.math.RoundingMode instances
* :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to
  java.math.RoundingMode constants with the same names
* nil for no rounding
sourceraw docstring

totalclj

(total monies)

Sums up multiple monetary amounts

Sums up multiple monetary amounts
sourceraw docstring

zeroclj

(zero unit)

Returns zero monetary amount for the given currency unit

Returns zero monetary amount for the given currency unit
sourceraw docstring

zero?clj

(zero? money)

Returns true if the given monetary amount is zero

Returns true if the given monetary amount is zero
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close