{"id":32184210,"url":"https://github.com/clojurewerkz/money","last_synced_at":"2026-02-21T13:01:30.247Z","repository":{"id":2694149,"uuid":"3687299","full_name":"clojurewerkz/money","owner":"clojurewerkz","description":"A Clojure library that deals with monetary values and currencies. Built on top of Joda Money.","archived":false,"fork":false,"pushed_at":"2025-08-05T23:05:34.000Z","size":177,"stargazers_count":157,"open_issues_count":1,"forks_count":19,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-10-21T23:42:53.847Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clojurewerkz.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-03-11T14:44:30.000Z","updated_at":"2025-08-05T23:05:37.000Z","dependencies_parsed_at":"2023-07-05T20:16:21.962Z","dependency_job_id":null,"html_url":"https://github.com/clojurewerkz/money","commit_stats":{"total_commits":210,"total_committers":18,"mean_commits":"11.666666666666666","dds":0.5761904761904761,"last_synced_commit":"85da6389cebbe274c41a7e9c6b9e8e71424d6ae5"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/clojurewerkz/money","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Fmoney","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Fmoney/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Fmoney/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Fmoney/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clojurewerkz","download_url":"https://codeload.github.com/clojurewerkz/money/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojurewerkz%2Fmoney/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29681468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T12:30:22.644Z","status":"ssl_error","status_checked_at":"2026-02-21T12:29:55.402Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-21T23:42:51.586Z","updated_at":"2026-02-21T13:01:30.241Z","avatar_url":"https://github.com/clojurewerkz.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ClojureWerkz Money, a Clojure Library to Work With Money\n\nClojureWerkz Money is a Clojure library that deals with monetary amounts.\nIt is built on top of [Joda Money](https://www.joda.org/joda-money/).\n\n\n## Project Goals\n\n * Expose most or all Joda Money features in an easy to use way\n * Be well documented and well tested\n * Integrate with popular libraries such as [Cheshire](https://github.com/dakrone/cheshire) and [Monger](http://clojuremongodb.info)\n * Don't introduce any significant amount of performance overhead\n\n\n## Project Maturity\n\nMoney is past `1.0` and is considered to be a complete, stable library.\n\n\n\n## Maven Artifacts\n\nMoney artifacts are [released to Clojars](https://clojars.org/clojurewerkz/money). If you are using Maven, add the following repository\ndefinition to your `pom.xml`:\n\n``` xml\n\u003crepository\u003e\n  \u003cid\u003eclojars.org\u003c/id\u003e\n  \u003curl\u003ehttp://clojars.org/repo\u003c/url\u003e\n\u003c/repository\u003e\n```\n\n### Most Recent Release\n\nWith Leiningen:\n\n    [clojurewerkz/money \"1.10.0\"]\n\n\nWith Maven:\n\n    \u003cdependency\u003e\n      \u003cgroupId\u003eclojurewerkz\u003c/groupId\u003e\n      \u003cartifactId\u003emoney\u003c/artifactId\u003e\n      \u003cversion\u003e1.10.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\n\n## Documentation\n\n### Monetary Amounts\n\nMonetary amounts are instantiated using `clojurewerkz.money.amounts` functions. They operate on\nfloating point amounts (doubles) or long values in major units (e.g. dollars) or minor units (e.g. cents).\n\nNote that some currencies do not have minor units (most notably `JPY`). For those, use `clojurewerkz.money.amounts/of-major`.\n\n``` clojure\n(require '[clojurewerkz.money.amounts :as ma])\n(require '[clojurewerkz.money.currencies :as mc])\n\n;; USD 10.50\n(ma/amount-of mc/USD 10.5)\n;; USD 10\n(ma/of-major mc/USD 10)\n;; USD 10.50\n(ma/of-minor mc/USD 1050)\n\n;; JPY 1000\n(ma/of-major mc/JPY 1000)\n```\n\nNote that not all currencies have minor units (most notably JPY does not).\n\nIt is possible to parse a string in the standard format `[currency unit] [amount]`, e.g. `JPY 1000`:\n\n``` clojure\n(require '[clojurewerkz.money.amounts :as ma])\n\n(ma/parse \"JPY 1000\")\n;= org.joda.money.Money instance for JPY 1000\n```\n\nMonetary amounts can be added, substracted and so on using `clojurewerkz.money.amounts/plus`,\n`clojurewerkz.money.amounts/minus`, `clojurewerkz.money.amounts/multiply`, and\n`clojurewerkz.money.amounts/divide` functions:\n\n``` clojure\n(require '[clojurewerkz.money.amounts    :as ma])\n(require '[clojurewerkz.money.currencies :as mc])\n\n(ma/plus (ma/amount-of mc/USD 10) (ma/amount-of mc/USD 100))\n;= USD 110\n\n(ma/minus (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 10))\n;= USD 90\n\n(ma/multiply (ma/amount-of mc/USD 100) 10)\n;= USD 1000\n\n;; :floor for flooring round mode\n(ma/divide (ma/amount-of mc/USD 100.1) 10 :floor)\n;= USD 10\n```\n\nIt is possible to add up all monies in a collection or sequence using `clojurewerkz.money.amounts/total`:\n\n``` clojure\n(require '[clojurewerkz.money.amounts    :as ma])\n(require '[clojurewerkz.money.currencies :as mc])\n\n(ma/total [(ma/amount-of mc/USD 10) (ma/amount-of mc/USD 100)])\n;= USD 110\n```\n\nIt is possible to compare monetary amounts using \u003e, \u003e=, \u003c and \u003c=.\n\n```clojure\n(require '[clojurewerkz.money.amounts    :as ma])\n(require '[clojurewerkz.money.currencies :as mc])\n\n(ma/\u003c (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 100))\n;= false\n\n(ma/\u003c= (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 120))\n;= true\n\n(ma/\u003e= (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 100) (ma/amount-of mc/USD 120))\n;= false\n\n(ma/\u003e (ma/amount-of mc/USD 200) (ma/amount-of mc/USD 100))\n;= true\n```\n\n### Rounding\n\n`clojurewerkz.money.amounts/round` is a function that performs rounding of\nmonetary values using one of the rounding modes:\n\n``` clojure\n(require '[clojurewerkz.money.amounts :as ams])\n\n(ams/round (ams/amount-of cu/USD 40.01) -1 :floor)\n;= USD 40\n\n(ams/round (ams/amount-of cu/USD 40.01) -1 :up)\n;= USD 50\n\n(ams/round (ams/amount-of cu/USD 45.24) 0 :floor)\n;= USD 45\n\n(ams/round (ams/amount-of cu/USD 45.24) 0 :up)\n;= USD 46\n\n(ams/round (ams/amount-of cu/USD 45.24) 1 :floor)\n;= USD 45.20\n\n(ams/round (ams/amount-of cu/USD 45.24) 1 :up)\n;= USD 45.30\n```\n\n\n### Currencies\n\nCurrency units use their ISO-4217 codes and represented by `org.joda.money.CurrencyUnit` instances.\nUsually the easiest way to use currency units is via `clojurewerkz.money.currencies` aliases:\n\n``` clojure\n(require '[clojurewerkz.money.currencies :as mc])\n\nmc/USD ;= USD currency unit\nmc/CAD ;= CAD currency unit\nmc/GBP ;= GBP currency unit\nmc/RUB ;= RUB currency unit\n```\n\n`clojurewerkz.money.currencies/for-code` and `clojurewerkz.money.currencies/of-country` can be used\nto get currency units by their ISO-4217 code strings and country abbreviations:\n\n``` clojure\n(require '[clojurewerkz.money.currencies :as mc])\n\n(mc/for-code \"CHF\")   ;= CHF currency unit\n(mc/for-country \"CH\") ;= CHF currency unit\n```\n\n`clojurewerkz.money.currencies/pseudo-currency?` is a predicate function that takes a currency unit\nand returns true if it is a pseudo-currency (e.g. [Bitcoin](http://bitcoin.org) or [IMF Special Drawing Rights](http://www.imf.org/external/np/exr/facts/sdr.htm)).\n\n\n### Currency Conversion\n\n`clojurewerkz.money.amounts/convert-to` converts a monetary value in one currency\nto another using provided exchange rate and rounding mode:\n\n``` clojure\n(require '[clojurewerkz.money.amounts :as ams])\n\n(ams/convert-to (ams/amount-of cu/GBP 65.65) cu/USD 1.523 :down)\n;= USD 99.98\n```\n\n\n### Formatting\n\nMoney supports formatting of monetary amounts with the `clojurewerkz.money.format/format` function\nwhich takes an amount and (optionally) a locale and a formatter:\n\n``` clojure\n(require '[clojurewerkz.money.currencies :as cu])\n(require '[clojurewerkz.money.amounts :refer [amount-of]])\n(require '[clojurewerkz.money.format :refer :all])\n\n(import java.util.Locale)\n\n;; format using default system locale\n(format (amount-of cu/GBP 20.0)) ;= GBP20,00\n;; format using UK locale\n(format (amount-of cu/GBP 20.0) Locale/UK) ;= £20.00\n\n;; format using Brazilian locale\n(format (amount-of cu/BRL 20.0) (Locale. \"pt\" \"BR\")) ;= R$20,00\n```\n\nDefault formatter uses localized currency symbol and amount and default locale which JVM infers from environment\nsettings.\n\n### Cheshire Integration\n\n`clojurewerkz.money.json`, when loaded, registers serializers for\n`org.joda.money.Money` and `org.joda.money.CurrencyUnit` with\nCheshire. Serialization conventions used are straightforward and\nproduce human readable values:\n\n * `(clojurewerkz.money.currencies/USD)` =\u003e `\"USD\"`\n * `(clojurewerkz.money.amounts/amount-of (clojurewerkz.money.currencies/USD) 20.5)` =\u003e `\"USD20.50\"` (will use system locale by default)\n\nTo use it, simply require the namespace and then use Cheshire\ngeneration functions as usual.\n\nThis extension requires Cheshire `5.0.x` or later. `clojure.data.json`\nis not supported.\n\n\n### Monger Integration\n\n`clojurewerkz.money.monger`, when loaded, registers BSON serializers\nfor `org.joda.money.Money` and\n`org.joda.money.CurrencyUnit`. Serialization conventions used are\nstraightforward and produce human readable values:\n\n * `(clojurewerkz.money.currencies/USD)` =\u003e `\"USD\"`\n * `(clojurewerkz.money.amounts/amount-of (clojurewerkz.money.currencies/USD) 20.5)` =\u003e `{\"currency-unit\" \"USD\" \"amount-in-minor-units\" 2050}`\n\nNote that serialization is one-way: loaded documents are returned as\nmaps because there is no way to tell them from regular BSON\ndocuments. `clojurewerkz.money.monger/from-stored-map` can be used to\nproduce `Money` instances from maps following the serialization\nconvention described above.\n\n\n### Hiccup Integration\n\n`clojurewerkz.money.hiccup`, when loaded, extends [Hiccup](https://github.com/weavejester/hiccup) HTML rendering protocol to render\nmonetary amounts and currency units.\nRendering conventions used are straightforward and\nproduce human readable values:\n\n * `(clojurewerkz.money.currencies/USD)` =\u003e `\"USD\"`\n * `(clojurewerkz.money.amounts/amount-of (clojurewerkz.money.currencies/USD) 20.5)` =\u003e `\"USD20.50\"` (will use system locale by default)\n\nTo use it, simply require the namespace and then use Hiccup\nas usual.\n\n\n## Community\n\n[ClojureWerkz Money has a mailing list](https://groups.google.com/group/clojure-money). Feel free to join it and ask any questions you may have.\n\nTo subscribe for announcements of releases, important changes and so on, please follow [@ClojureWerkz](https://twitter.com/#!/clojurewerkz) on Twitter.\n\n\n\n## Supported Clojure Versions\n\nClojureWerkz Money is built from the ground up for Clojure 1.4 and up.\nThe most recent release is always recommended.\n\n\n## Continuous Integration\n\n[![Continuous Integration status](https://secure.travis-ci.org/clojurewerkz/money.png)](http://travis-ci.org/clojurewerkz/money)\n\nCI is hosted by [travis-ci.org](http://travis-ci.org)\n\n\n## Development\n\nMoney uses [Leiningen 2](https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md). Make sure you have it installed and then run tests\nagainst all supported Clojure versions using\n\n    lein all test\n\nThen create a branch and make your changes on it. Once you are done with your changes and all tests pass, submit\na pull request on GitHub.\n\n\n## License\n\nCopyright © 2012-2022 Michael S. Klishin, Alex Petrov, and the ClojureWerkz team.\n\nDouble licensed under the [Eclipse Public License](http://www.eclipse.org/legal/epl-v10.html) (the same as Clojure) or\nthe [Apache Public License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojurewerkz%2Fmoney","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclojurewerkz%2Fmoney","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojurewerkz%2Fmoney/lists"}