git clone ''


ClojureWerkz Money, a Clojure Library to Work With Money

ClojureWerkz Money is a Clojure library that deals with monetary amounts. It is built on top of Joda Money.

Project Goals

Project Maturity

Money is past 1.0 and is considered to be a complete, stable library.

Maven Artifacts

Money artifacts are released to Clojars. If you are using Maven, add the following repository definition to your pom.xml:


Most Recent Release

With Leiningen:

[clojurewerkz/money "1.10.0"]

With Maven:



Monetary Amounts

Monetary amounts are instantiated using functions. They operate on floating point amounts (doubles) or long values in major units (e.g. dollars) or minor units (e.g. cents).

Note that some currencies do not have minor units (most notably JPY). For those, use

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

;; USD 10.50
(ma/amount-of mc/USD 10.5)
;; USD 10
(ma/of-major mc/USD 10)
;; USD 10.50
(ma/of-minor mc/USD 1050)

;; JPY 1000
(ma/of-major mc/JPY 1000)

Note that not all currencies have minor units (most notably JPY does not).

It is possible to parse a string in the standard format [currency unit] [amount], e.g. JPY 1000:

(require '[ :as ma])

(ma/parse "JPY 1000")
;= instance for JPY 1000

Monetary amounts can be added, substracted and so on using,,, and functions:

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

(ma/plus (ma/amount-of mc/USD 10) (ma/amount-of mc/USD 100))
;= USD 110

(ma/minus (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 10))
;= USD 90

(ma/multiply (ma/amount-of mc/USD 100) 10)
;= USD 1000

;; :floor for flooring round mode
(ma/divide (ma/amount-of mc/USD 100.1) 10 :floor)
;= USD 10

It is possible to add up all monies in a collection or sequence using

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

(ma/total [(ma/amount-of mc/USD 10) (ma/amount-of mc/USD 100)])
;= USD 110

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

Rounding is a 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


Currency units use their ISO-4217 codes and represented by instances. Usually the easiest way to use currency units is via aliases:

(require '[ :as mc])

mc/USD ;= USD currency unit
mc/CAD ;= CAD currency unit
mc/GBP ;= GBP currency unit
mc/RUB ;= RUB currency unit and can be used to get currency units by their ISO-4217 code strings and country abbreviations:

(require '[ :as mc])

(mc/for-code "CHF")   ;= CHF currency unit
(mc/for-country "CH") ;= CHF currency unit is a predicate function that takes a currency unit and returns true if it is a pseudo-currency (e.g. Bitcoin or IMF Special Drawing Rights).

Currency Conversion 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


Money supports formatting of monetary amounts with the function which takes an amount and (optionally) a locale and a formatter:

(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)) ;= GBP20,00
;; format using UK locale
(format (amount-of cu/GBP 20.0) Locale/UK) ;= £20.00

;; format using Brazilian locale
(format (amount-of cu/BRL 20.0) (Locale. "pt" "BR")) ;= R$20,00

Default formatter uses localized currency symbol and amount and default locale which JVM infers from environment settings.

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

To use it, simply require the namespace and then use Cheshire generation functions as usual.

This extension requires Cheshire 5.0.x or later. is not supported.

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

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.

Hiccup Integration, when loaded, extends Hiccup HTML rendering protocol to render monetary amounts and currency units. Rendering conventions used are straightforward and produce human readable values:

To use it, simply require the namespace and then use Hiccup as usual.


ClojureWerkz Money has a mailing list. Feel free to join it and ask any questions you may have.

To subscribe for announcements of releases, important changes and so on, please follow @ClojureWerkz on Twitter.

Supported Clojure Versions

ClojureWerkz Money is built from the ground up for Clojure 1.4 and up. The most recent release is always recommended.

Continuous Integration

Continuous Integration status

CI is hosted by


Money uses Leiningen 2. Make sure you have it installed and then run tests against all supported Clojure versions using

lein all test

Then create a branch and make your changes on it. Once you are done with your changes and all tests pass, submit a pull request on GitHub.


Copyright © 2012-2016 Michael S. Klishin, Alex Petrov, and the ClojureWerkz team.

Double licensed under the Eclipse Public License (the same as Clojure) or the Apache Public License 2.0.