Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

194 lines (116 sloc) 5.571 kb

Changes between 1.4.0 and 1.5.0

Comparison Function Correctness

<, >, <=, >= now return a boolean on the 1-arg arity, as per docstring.

Contributed by Nicola Mometto.

Changes between 1.3.0 and 1.4.0

Roudning Multiplication now provides another arity that allows for multiplication by a double, just like with divide:

(ams/multiply (ams/amount-of cu/USD 45) 10.1 :floor)
;= USD 454.50

Changes between 1.2.0 and 1.3.0

Hiccup Integration, when compiled, will extend Hiccup's HTML rendering protocol for monetary amounts and currency units. Internally it uses default formatter used by*default-formatter*, which can be rebound.

Formatting of Monetary Amounts is a new function that formats monetary amounts using default or provided locale:

(require '[ :as cu)
(require '[ :refer [amount-of])
(require '[ :refer :all])

(import java.util.Locale)

;; format using default system locale
(format (amount-of cu/GBP 20.0) Locale/UK) ;= GBP20,00
;; format using UK locale
(format (amount-of cu/GBP 20.0) Locale/UK) ;= £10.00

Custom Joda Money formatters are also supported.

Addition and Subtraction of Monetary Amounts and now accept monetary amounts as well as doubles as 2nd argument.

Contributed by Ryan Neufeld.

Changes between 1.1.0 and 1.2.0

ClojureWerkz Money now provides a list of additional currencies on top of the default Joda Money currency provider. Right now the only additional currency is BTC (Bitcoin).

Changes between 1.0.0 and 1.1.0

It is possible to compare monetary amounts using >, >=, < and <=.

(require '[    :as ma])
(require '[ :as mc])

(ma/< (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 100))
;= false

(ma/<= (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 120))
;= true

(ma/>= (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 120))
;= false

(ma/> (ma/amount-of mc/USD 200) (ma/amount-of mc/USD 100))
;= true

Changes between 1.0.0-beta2 and 1.0.0 converts a monetary value in one currency to another using provided exchange rate and rounding mode:

(require '[ :as ams])

(ams/convert-to (ams/amount-of cu/GBP 65.65) cu/USD 1.523 :down)
;= USD 99.98 is a new function that performs rounding of monetary values using one of the rounding modes:

(require '[ :as ams])

(ams/round (ams/amount-of cu/USD 40.01) -1 :floor)
;= USD 40

(ams/round (ams/amount-of cu/USD 40.01) -1 :up)
;= USD 50

(ams/round (ams/amount-of cu/USD 45.24) 0 :floor)
;= USD 45

(ams/round (ams/amount-of cu/USD 45.24) 0 :up)
;= USD 46

(ams/round (ams/amount-of cu/USD 45.24) 1 :floor)
;= USD 45.20

(ams/round (ams/amount-of cu/USD 45.24) 1 :up)
;= USD 45.30

Changes between 1.0.0-beta1 and 1.0.0-beta2

Monger Integration, when loaded, registers BSON serializers for and Serialization conventions used are straightforward and produce human readable values:

  • ( => "USD"
  • ( ( 20.5) => {"currency-unit" "USD" "amount-in-minor-units" 2050}

Note that serialization is one-way: loaded documents are returned as maps because there is no way to tell them from regular BSON documents. can be used to produce Money instances from maps following the serialization convention described above.

Cheshire Integration, when loaded, registers serializers for and Serialization conventions used are straightforward and produce human readable values:

  • ( => "USD"
  • ( ( 20.5) => "USD 20.50"

This requires Cheshire 5.0.x or later. is not supported. and min and are new functions that return the greater and the lesser of two monetary amounts. is a new namespace that defines vars with currency units. For example, instead of ( "NOK") it is now possible to use and Related,,, and are new predicate functions that work with monetary amounts.

Changes between 1.0.0-SNAPSHOT and 1.0.0-beta1

Joda Money 0.8

Joda Money was upgraded to 0.8.

Clojure 1.5 By Default

Money now depends on Clojure 1.5. It still supports 1.3+ but the default version is now 1.5.

Jump to Line
Something went wrong with that request. Please try again.