-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.randomseed.bankster.currency.html
180 lines (180 loc) · 70.9 KB
/
io.randomseed.bankster.currency.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>io.randomseed.bankster.currency documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Bankster</span> <span class="project-version">1.2.16</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="10_introduction.html"><div class="inner"><span>Introduction</span></div></a></li><li class="depth-1 "><a href="20_data_structures.html"><div class="inner"><span>Data Structures</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>randomseed</span></div></div></li><li class="depth-3"><a href="io.randomseed.bankster.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bankster</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.config.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>config</span></div></a></li><li class="depth-4 branch current"><a href="io.randomseed.bankster.currency.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>currency</span></div></a></li><li class="depth-4"><a href="io.randomseed.bankster.money.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>money</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.money.inter-ops.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>inter-ops</span></div></a></li><li class="depth-5"><a href="io.randomseed.bankster.money.ops.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ops</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.registry.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>registry</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.scale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scale</span></div></a></li><li class="depth-4"><a href="io.randomseed.bankster.util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>util</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.util.fs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fs</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.util.importer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>importer</span></div></a></li><li class="depth-5"><a href="io.randomseed.bankster.util.map.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>map</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-*default*"><div class="inner"><span>*default*</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-add-countries"><div class="inner"><span>add-countries</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-add-countries.21"><div class="inner"><span>add-countries!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-add-localized-properties"><div class="inner"><span>add-localized-properties</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-add-localized-props.21"><div class="inner"><span>add-localized-props!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-add-weighted-code"><div class="inner"><span>add-weighted-code</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-auto-scaled"><div class="inner"><span>auto-scaled</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-auto-scaled.3F"><div class="inner"><span>auto-scaled?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-big.3F"><div class="inner"><span>big?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-code"><div class="inner"><span>code</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-code-literal"><div class="inner"><span>code-literal</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-combank.3F"><div class="inner"><span>combank?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-commodity.3F"><div class="inner"><span>commodity?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-config-.3Eregistry"><div class="inner"><span>config->registry</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-countries"><div class="inner"><span>countries</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-crypto.3F"><div class="inner"><span>crypto?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-currency.3F"><div class="inner"><span>currency?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-data-literal"><div class="inner"><span>data-literal</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-decentralised.3F"><div class="inner"><span>decentralised?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-decentralized.3F"><div class="inner"><span>decentralized?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-display-name"><div class="inner"><span>display-name</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-display-name-native"><div class="inner"><span>display-name-native</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-domain"><div class="inner"><span>domain</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-experimental.3F"><div class="inner"><span>experimental?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-fiat.3F"><div class="inner"><span>fiat?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-fiduciary.3F"><div class="inner"><span>fiduciary?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-formatter"><div class="inner"><span>formatter</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-formatter-extended"><div class="inner"><span>formatter-extended</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-has-country.3F"><div class="inner"><span>has-country?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-has-kind.3F"><div class="inner"><span>has-kind?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-has-numeric-id.3F"><div class="inner"><span>has-numeric-id?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-in-domain.3F"><div class="inner"><span>in-domain?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-iso.3F"><div class="inner"><span>iso?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-java"><div class="inner"><span>java</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-kind"><div class="inner"><span>kind</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-kind-of.3F"><div class="inner"><span>kind-of?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-localized-properties"><div class="inner"><span>localized-properties</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-localized-property"><div class="inner"><span>localized-property</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-map-.3Enew"><div class="inner"><span>map->new</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-Monetary"><div class="inner"><span>Monetary</span></div></a></li><li class="depth-2 branch"><a href="io.randomseed.bankster.currency.html#var-defined.3F"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>defined?</span></div></a></li><li class="depth-2 branch"><a href="io.randomseed.bankster.currency.html#var-id"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>id</span></div></a></li><li class="depth-2 branch"><a href="io.randomseed.bankster.currency.html#var-of-id"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>of-id</span></div></a></li><li class="depth-2 branch"><a href="io.randomseed.bankster.currency.html#var-present.3F"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>present?</span></div></a></li><li class="depth-2 branch"><a href="io.randomseed.bankster.currency.html#var-same-ids.3F"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>same-ids?</span></div></a></li><li class="depth-2"><a href="io.randomseed.bankster.currency.html#var-unit"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>unit</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-name"><div class="inner"><span>name</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-name-native"><div class="inner"><span>name-native</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-new"><div class="inner"><span>new</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-new-currency"><div class="inner"><span>new-currency</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-no-numeric-id"><div class="inner"><span>no-numeric-id</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-nr"><div class="inner"><span>nr</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-ns"><div class="inner"><span>ns</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-ns-code"><div class="inner"><span>ns-code</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-numeric"><div class="inner"><span>numeric</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-numeric-id"><div class="inner"><span>numeric-id</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-of"><div class="inner"><span>of</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-of-country"><div class="inner"><span>of-country</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-official.3F"><div class="inner"><span>official?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-possible.3F"><div class="inner"><span>possible?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-register"><div class="inner"><span>register</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-register.21"><div class="inner"><span>register!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-remove-countries"><div class="inner"><span>remove-countries</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-remove-countries.21"><div class="inner"><span>remove-countries!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-remove-localized-properties"><div class="inner"><span>remove-localized-properties</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-remove-localized-props.21"><div class="inner"><span>remove-localized-props!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-sc"><div class="inner"><span>sc</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-scale"><div class="inner"><span>scale</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-set-default.21"><div class="inner"><span>set-default!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-set-default-registry.21"><div class="inner"><span>set-default-registry!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-standard.3F"><div class="inner"><span>standard?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-symbol"><div class="inner"><span>symbol</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-symbol-native"><div class="inner"><span>symbol-native</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-unregister"><div class="inner"><span>unregister</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-unregister.21"><div class="inner"><span>unregister!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-unset-default.21"><div class="inner"><span>unset-default!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-update"><div class="inner"><span>update</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-update.21"><div class="inner"><span>update!</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-val-auto-scaled.3F"><div class="inner"><span>val-auto-scaled?</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-weight"><div class="inner"><span>weight</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-with"><div class="inner"><span>with</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.currency.html#var-with-registry"><div class="inner"><span>with-registry</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">io.randomseed.bankster.currency</h1><div class="doc"><div class="markdown"></div></div><div class="public anchor" id="var-*default*"><h3>*default*</h3><h4 class="dynamic">dynamic</h4><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default currency unit to be applied when creating Money objects without the currency specified.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L44">view source</a></div></div><div class="public anchor" id="var-add-countries"><h3>add-countries</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(add-countries registry currency-id country-ids)</code></div><div class="doc"><div class="markdown"><p>Associates the given country or countries with a currency. If the currency does not exist, exception is thrown. If the currency exists but differs in any detail from the existing currency from the registry, exception is thrown. If the currency exists and equals to the given in any aspect, country associations are added. Links from other countries to the currency are not removed unless the country is already linked with some other currency; in this case it will be unlinked first.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L847">view source</a></div></div><div class="public anchor" id="var-add-countries.21"><h3>add-countries!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(add-countries! currency country-ids)</code></div><div class="doc"><div class="markdown"><p>Associates the given country (a keyword) or countries (seqable collection of keywords) with a currency in the global registry. If the currency does not exist, exception is thrown. If the currency exists but differs in any detail from the existing currency from the registry, exception is thrown. If the currency exists and equals to the given in any aspect, country associations are added. Links from other countries to the currency are not removed unless the country is already linked with some other currency; in this case it will be unlinked first.</p>
<p>If the currency is nil, returns current state of a global registry (but not a dynamic registry, even if it is set).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1049">view source</a></div></div><div class="public anchor" id="var-add-localized-properties"><h3>add-localized-properties</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(add-localized-properties registry currency-id properties)</code></div><div class="doc"><div class="markdown"><p>Adds localized properties of a currency to the given registry. Overwrites existing properties.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L881">view source</a></div></div><div class="public anchor" id="var-add-localized-props.21"><h3>add-localized-props!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(add-localized-props! currency properties)</code></div><div class="doc"><div class="markdown"><p>Associates the given currency with a map of localized properties.</p>
<p>If the currency is nil, returns current state of a global registry (but not a dynamic registry, even if it is set).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1075">view source</a></div></div><div class="public anchor" id="var-add-weighted-code"><h3>add-weighted-code</h3><h4 class="added">added in 1.2.5</h4><div class="usage"><code>(add-weighted-code registry currency-id)</code></div><div class="doc"><div class="markdown"><p>Associates the existing currency code with the currency object in the given registry using the value of the .weight field. The given currency-id may be expressed with any object that can be used to get the currency from a registry (internally the unit function is used). Therefore, passing the currency object having a different weight will not cause the weight to be updated since it will be used for identification only.</p>
<p>Currency must exist in the cur-id->cur database of the registry. This function will add an association to the cur-code->curs database. If both, the weight and code are the same, registry is returned as is.</p>
<p>This is a low-level function used to ensure that a code-to-currency mapping is created within a registry. To simply update currency’s weight, use the update or update! function.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L898">view source</a></div></div><div class="public anchor" id="var-auto-scaled"><h3>auto-scaled</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Expresses the scale of a currency which is automatic and not limited to certain decimal places.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L34">view source</a></div></div><div class="public anchor" id="var-auto-scaled.3F"><h3>auto-scaled?</h3><div class="usage"><code>(auto-scaled? c)</code><code>(auto-scaled? c registry)</code></div><div class="doc"><div class="markdown"><p>Alias for big?.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1202">view source</a></div></div><div class="public anchor" id="var-big.3F"><h3>big?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(big? c)</code><code>(big? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency has an automatic scale (decimal places).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1196">view source</a></div></div><div class="public anchor" id="var-code"><h3>code</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(code c)</code><code>(code c registry)</code><code>(code c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency code as a string for the given currency object. If the currency identifier is namespaced only the base code (without a namespace) will be returned. Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L631">view source</a></div></div><div class="public anchor" id="var-code-literal"><h3>code-literal</h3><h4 class="added">added in 1.2.4</h4><div class="usage"><code>(code-literal arg)</code></div><div class="doc"><div class="markdown"><p>Tagged literal handler for Clojure code. Emits compound forms that are going to be evaluated.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1577">view source</a></div></div><div class="public anchor" id="var-combank.3F"><h3>combank?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(combank? c)</code><code>(combank? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is a kind of :COMBANK.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1259">view source</a></div></div><div class="public anchor" id="var-commodity.3F"><h3>commodity?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(commodity? c)</code><code>(commodity? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is a kind of :COMMODITY.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1265">view source</a></div></div><div class="public anchor" id="var-config-.3Eregistry"><h3>config->registry</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(config->registry)</code><code>(config->registry resource-path)</code><code>(config->registry resource-path regi)</code></div><div class="doc"><div class="markdown"><p>Loads currencies and countries from an EDN file. First argument should be a string with path to the EDN resource file containing registry data, second should be a registry. Returns a registry initialized using values from the EDN file.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1097">view source</a></div></div><div class="public anchor" id="var-countries"><h3>countries</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(countries c)</code><code>(countries c registry)</code><code>(countries c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns a set of country IDs (keywords) for which the given currency is main currency. If there are no countries associated with a currency, returns nil. Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L652">view source</a></div></div><div class="public anchor" id="var-crypto.3F"><h3>crypto?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(crypto? c)</code><code>(crypto? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is a cryptocurrency. It is just a helper that check if the domain of a currency equals to :CRYPTO.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1208">view source</a></div></div><div class="public anchor" id="var-currency.3F"><h3>currency?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(currency? c)</code><code>(currency? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given value is represented by a valid currency object. Registry argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1158">view source</a></div></div><div class="public anchor" id="var-data-literal"><h3>data-literal</h3><h4 class="added">added in 1.2.4</h4><div class="usage"><code>(data-literal arg)</code></div><div class="doc"><div class="markdown"><p>Tagged literal handler for EDN data files. Emits Currency objects or nil values.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1586">view source</a></div></div><div class="public anchor" id="var-decentralised.3F"><h3>decentralised?</h3><div class="usage"><code>(decentralised? c)</code><code>(decentralised? c registry)</code></div><div class="doc"><div class="markdown"><p>Alias for decentralized?</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1277">view source</a></div></div><div class="public anchor" id="var-decentralized.3F"><h3>decentralized?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(decentralized? c)</code><code>(decentralized? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is a kind of :DECENTRALIZED.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1271">view source</a></div></div><div class="public anchor" id="var-display-name"><h3>display-name</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(display-name currency)</code><code>(display-name currency locale)</code><code>(display-name currency locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency display name as a string for the given currency object and locale. If the locale is not given, a default one is used. Uses global registry if a registry is not given.</p>
<p>The following tactic is applied:</p>
<ul>
<li>
<p>The registry field .cur-id->localized is looked up for the currency ID key. If it’s found then a key with the given locale object (a kind of java.util.Locale) is obtained. If there is no such key, the default one :* is tried (a keyword). The resulting value should be a map of localized properties in which an entry under the key :symbol should exist. Its value will be returned, if found.</p>
</li>
<li>
<p>If the above method failed and the given currency is ISO-standardized then Java methods will be tried to obtain it.</p>
</li>
<li>
<p>If the above method failed a currency code will be returned.</p>
</li>
</ul>
<p>A locale can be expressed as java.util.Locale object or any other object (like a string or a keyword) which can be used to look up the locale.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1443">view source</a></div></div><div class="public anchor" id="var-display-name-native"><h3>display-name-native</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(display-name-native currency)</code><code>(display-name-native currency registry)</code></div><div class="doc"><div class="markdown"><p>Like display-name but for ISO-standardized currencies uses locale assigned to the first country where a currency is the default. When locale is given it is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1483">view source</a></div></div><div class="public anchor" id="var-domain"><h3>domain</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(domain c)</code><code>(domain c registry)</code><code>(domain c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns currency domain as a keyword. For currencies with simple identifiers it will be :ISO-4217. For currencies with namespace-qualified identifiers it will be the upper-cased namespace name (e.g. :CRYPTO) set during creation a currency object. Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L577">view source</a></div></div><div class="public anchor" id="var-experimental.3F"><h3>experimental?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(experimental? c)</code><code>(experimental? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is a kind of :EXPERIMENTAL.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1283">view source</a></div></div><div class="public anchor" id="var-fiat.3F"><h3>fiat?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(fiat? c)</code><code>(fiat? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is a kind of :FIAT.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1247">view source</a></div></div><div class="public anchor" id="var-fiduciary.3F"><h3>fiduciary?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(fiduciary? c)</code><code>(fiduciary? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is a kind of :FIDUCIARY.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1253">view source</a></div></div><div class="public anchor" id="var-formatter"><h3>formatter</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(formatter currency)</code><code>(formatter currency locale)</code><code>(formatter currency locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns currency formatter as java.text.DecimalFormat instance for the given currency and locale. If locale is not given the default one will be used. Due to caching strategy it is advised to express locale with a keyword.</p>
<p>The formatter is a mutable clone of Java data structure.</p>
<p>In case of currencies other than ISO-standardized (and predefined in Java) the currency field of this formatter will be set to the currency of XXX.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1635">view source</a></div></div><div class="public anchor" id="var-formatter-extended"><h3>formatter-extended</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(formatter-extended currency)</code><code>(formatter-extended currency locale)</code><code>(formatter-extended currency locale opts)</code><code>(formatter-extended currency locale {:keys [scale rounding-mode grouping grouping-size negative-prefix negative-suffix positive-prefix positive-suffix always-sep-dec currency-symbol-fn min-fraction-digits max-fraction-digits min-integer-digits max-integer-digits], :as opts} registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency formatter as java.text.DecimalFormat instance for the given currency, customizable with the given opts map. If the locale is not given then the default one will be used. Due to caching strategy it is advised to express locale with a keyword.</p>
<p>The formatter is a mutable clone of Java data structure.</p>
<p>In case of currencies other than ISO-standardized (and predefined in Java) the currency field of this formatter will be set to the currency of XXX.</p>
<p>Options map can have the following keys:</p>
<ul>
<li>:rounding-mode - RoundingMode, rounding mode to apply when scaling</li>
<li>:grouping - Boolean, if true then grouping will be used</li>
<li>:grouping-size - integer, size of a group when grouping</li>
<li>:negative-prefix - String, negative prefix to use</li>
<li>:negative-suffix - String, negative suffix to use</li>
<li>:positive-prefix - String, positive prefix to use</li>
<li>:positive-suffix - String, positive suffix to use</li>
<li>:always-sep-dec - Boolean, if true then the decimal separator will always be shown</li>
<li>:currency-symbol-fn - a function used on a bankster/Currency object to get its symbol as a string</li>
<li>:min-fraction-digits - integer, the minimum number of digits allowed in the fraction portion of an amount</li>
<li>:min-integer-digits - integer, the minimum number of digits allowed in the integer portion of an amount</li>
<li>:max-fraction-digits - integer, the maximum number of digits allowed in the fraction portion of an amount</li>
<li>:max-integer-digits - integer, the maximum number of digits allowed in the integer portion of an amount</li>
<li>:scale - sets both :min-fraction-digits and :max-fraction digits to the same value.</li>
</ul>
<p>When choosing different currency, all parameters of a formatter are initially set to that currency. Additionally re-scaling may take place for the amount if scales are different.</p>
<p>The function assigned to the :currency-symbol-fn should take 3 arguments: currency, locale and registry.</p>
<p>It is advised to express locale using a keyword when huge amount of operations is expected.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1662">view source</a></div></div><div class="public anchor" id="var-has-country.3F"><h3>has-country?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(has-country? c)</code><code>(has-country? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency has at least one country for which it is an official currency.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1180">view source</a></div></div><div class="public anchor" id="var-has-kind.3F"><h3>has-kind?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(has-kind? c)</code><code>(has-kind? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency has its kind defined.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1235">view source</a></div></div><div class="public anchor" id="var-has-numeric-id.3F"><h3>has-numeric-id?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(has-numeric-id? c)</code><code>(has-numeric-id? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency has a numeric ID.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1174">view source</a></div></div><div class="public anchor" id="var-in-domain.3F"><h3>in-domain?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(in-domain? ns c)</code><code>(in-domain? ns c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency has a domain set to the first given argument.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1189">view source</a></div></div><div class="public anchor" id="var-iso.3F"><h3>iso?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(iso? c)</code><code>(iso? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency is an official currency and its identifier is compliant with ISO standard. It is just a helper which checks if the :domain field of a currency equals :ISO-4217.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1215">view source</a></div></div><div class="public anchor" id="var-java"><h3>java</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(java currency)</code><code>(java currency registry)</code></div><div class="doc"><div class="markdown"><p>For ISO-standardized currency, returns corresponding java.util.Currency object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1517">view source</a></div></div><div class="public anchor" id="var-kind"><h3>kind</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(kind c)</code><code>(kind c registry)</code><code>(kind c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns currency kind. It is a keyword which describes origin of its value. Currently known kinds are:</p>
<ul>
<li>:FIAT – legal tender issued by government or other authority</li>
<li>:FIDUCIARY - accepted medium of exchange issued by a fiduciary or fiduciaries</li>
<li>:DECENTRALIZED - accepted medium of exchange issued by a distributed ledger</li>
<li>:COMBANK - commercial bank money</li>
<li>:COMMODITY - accepted medium of exchange based on commodities</li>
<li>:EXPERIMENTAL - pseudo-currency used for testing purposes.</li>
</ul>
<p>The function may return nil if the currency is a no-currency. Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L598">view source</a></div></div><div class="public anchor" id="var-kind-of.3F"><h3>kind-of?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(kind-of? c kind)</code><code>(kind-of? c kind registry)</code></div><div class="doc"><div class="markdown"><p>Returns a kind of the given currency equals to the one given as a second argument.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1241">view source</a></div></div><div class="public anchor" id="var-localized-properties"><h3>localized-properties</h3><h4 class="added">added in 1.0.8</h4><div class="usage"><code>(localized-properties c)</code><code>(localized-properties c registry)</code></div><div class="doc"><div class="markdown"><p>Returns a map of localized properties for the given currency. Locale objects are translated back to their keyword representations.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1306">view source</a></div></div><div class="public anchor" id="var-localized-property"><h3>localized-property</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(localized-property property currency-id)</code><code>(localized-property property currency-id locale)</code><code>(localized-property property currency-id locale registry)</code></div><div class="doc"><div class="markdown"><p>Gets the localized property of a currency from the given registry and locale. If the registry is not given, the global one will be used. If the locale is not given, the default locale for the environment will be used. Locale can be expressed as a Locale object or any object which can be used to identify the locale (e.g. a keyword or a string).</p>
<p>Localized properties are maps keyed by currency identifiers, containing another maps keyed by locale objects. There is a special key :* which identifies default properties used when there are no properties in locale-keyed maps.</p>
<p>Let’s take a hypothetical entry of a registry database <code>.cur-id->localized</code>:</p>
<pre><code class="language-clojure">{:XXX {#object[java.util.Locale 0x3f5af72f "en_US"] {:symbol "$"}}
{#object[java.util.Locale 0x3f5af72f "en"] {:symbol "X$"}
{:* {:symbol "ABC"}}
</code></pre>
<ul>
<li>Calling <code>(localized-property :symbol :XXX :en_US)</code> will return <code>$</code>.</li>
<li>Calling <code>(localized-property :symbol :XXX :en_GB)</code> will return <code>X$</code>.</li>
<li>Calling <code>(localized-property :symbol :XXX :pl_PL)</code> will return <code>ABC</code>.</li>
</ul>
<p>The first is self-explanatory.</p>
<p>The second falls back to <code>en</code> because the function will re-try the language part (<code>en</code>) alone when the property was not found. The same method is repeatedly applied to other components of a locale (variant, script and extensions – if any). So for the locale identified by <code>th_TH_TH_#u-nu-thai</code> the following keys will be tried:</p>
<ul>
<li><code>th_TH_TH_#u-nu-thai</code>,</li>
<li><code>th_TH_TH_#u-nu</code>,</li>
<li><code>th_TH_TH_#u</code>,</li>
<li><code>th_TH_TH</code>,</li>
<li><code>th_TH</code> and <code>th</code>.</li>
</ul>
<p>The third example renders <code>ABC</code> because there is an entry of <code>:symbol</code> in the default properties map under the key <code>:*</code>.</p>
<p>Please note that functions for getting particular properties may apply additional steps to obtain them. For instance, the display-name function will first call the localized-property and if it fails it will fall back to Java methods (if the currency is ISO-standardized). If that will fail too then it will return a currency code.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1324">view source</a></div></div><div class="public anchor" id="var-map-.3Enew"><h3>map->new</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(map->new m)</code></div><div class="doc"><div class="markdown"><p>Creates new currency record from a map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L100">view source</a></div></div><div class="public anchor" id="var-Monetary"><h3>Monetary</h3><h4 class="type">protocol</h4><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>The Monetary protocol describes basic operations on currencies. It uses single dispatch to allow currencies to be expressed with different kinds of data (keywords, symbols, strings, native Currency objects etc.).</p>
</div></div><div class="members"><h4>members</h4><div class="inner"><div class="public anchor" id="var-defined.3F"><h3>defined?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(defined? id)</code><code>(defined? id registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given currency (identified by its ID) exists in a registry. If the registry is not given, the global one will be used, trying a dynamic registry bound to the registry/<em>default</em> first.</p>
</div></div></div><div class="public anchor" id="var-id"><h3>id</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(id id)</code><code>(id id registry)</code></div><div class="doc"><div class="markdown"><p>Returns a unique identifier of the given currency as a keyword. The currency can be expressed as a Currency object, a keyword, a string or any other type which is recognized by the <code>unit</code> protocol method.</p>
<p>The role of the default registry is advisory. If the registry argument is not given (or it is nil) and the dynamic variable <code>io.randomseed.bankster.registry/*default*</code> does not refer to a truthy value then the ID will be returned regardless of whether the currency exists in a registry, by simply converting it to a keyword or getting a field from a Currency object. Still, the default registry will be consulted to resolve possible currency code. For instance: if <code>BTC</code> is a currency code of a registered currency identified as <code>:crypto/BTC</code> then the resulting value for <code>:BTC</code> will be <code>:crypto/BTC</code>; but for <code>:BLABLA</code> (which does not exist in a registry) the resulting value will be <code>:BLABLA</code>.</p>
<p>If a registry is given (or a dynamic registry is set) then trying to use a non-existing currency will cause an exception to be thrown.</p>
</div></div></div><div class="public anchor" id="var-of-id"><h3>of-id</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(of-id id)</code><code>(of-id id registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency object for the given ID and a registry. If the registry is not given, it will use the global one, but will first try a registry bound to the <code>io.randomseed.bankster.registry/*default*</code> dynamic variable (if it’s set).</p>
<p>The currency is always taken from a registry (on a basis of its ID) even if a Currency object was given, with one exception: if a currency is passed and the second argument is explicitly set to nil then the object will be returned as is, without consulting the registry.</p>
</div></div></div><div class="public anchor" id="var-present.3F"><h3>present?</h3><h4 class="added">added in 1.0.2</h4><div class="usage"><code>(present? id)</code><code>(present? id registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if a currency of the given currency code or ID exists in a registry. If the registry is not given, the global one will be used, trying a dynamic registry bound to the registry/<em>default</em> first.</p>
</div></div></div><div class="public anchor" id="var-same-ids.3F"><h3>same-ids?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(same-ids? a b)</code><code>(same-ids? a b registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if two currencies have the same ID. If the registry is not given, it will use the global one, but will first try a dynamic registry bound to the <code>io.randomseed.bankster.registry/*default*</code> dynamic variable.</p>
</div></div></div><div class="public anchor" id="var-unit"><h3>unit</h3><h4 class="added">added in 1.0.2</h4><div class="usage"><code>(unit id)</code><code>(unit id registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency object for the given ID or currency code. If the registry is not given, it will try a registry bound to the <code>io.randomseed.bankster.registry/*default*</code> dynamic variable and if it is not set (or is falsy value) it will use the global registry.</p>
<p>If a Currency object is passed, it will be returned as is without consulting the registry, unless the registry is given (and not nil) or the dynamic registry is set. In this case the currency will be obtained from a registry on a basis of its ID extracted from the given object.</p>
<p>If the registry is given (or dynamic registry is set) and the currency does not exist in a registry an exception will be thrown, regardless of whether a Currency object was passed or not.</p>
<p>Explicitly passing nil as a second argument when a Currency object is given can speed things up a bit in certain scenarios by bypassing dynamic variable check.</p>
</div></div></div></div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L131">view source</a></div></div><div class="public anchor" id="var-name"><h3>name</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(name currency)</code><code>(name currency locale)</code><code>(name currency locale registry)</code></div><div class="doc"><div class="markdown"><p>Alias for display-name.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1498">view source</a></div></div><div class="public anchor" id="var-name-native"><h3>name-native</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(name-native currency)</code><code>(name-native currency registry)</code></div><div class="doc"><div class="markdown"><p>Alias for display-name-native.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1506">view source</a></div></div><div class="public anchor" id="var-new"><h3>new</h3><div class="usage"><code>(new id)</code><code>(new id numeric-id)</code><code>(new id numeric-id scale)</code><code>(new id numeric-id scale kind)</code><code>(new id numeric-id scale kind domain)</code><code>(new id numeric-id scale kind domain weight)</code></div><div class="doc"><div class="markdown"><p>Alias for new-currency.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L116">view source</a></div></div><div class="public anchor" id="var-new-currency"><h3>new-currency</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(new-currency id)</code><code>(new-currency id numeric-id)</code><code>(new-currency id numeric-id scale)</code><code>(new-currency id numeric-id scale kind)</code><code>(new-currency id numeric-id scale kind domain)</code><code>(new-currency id numeric-id scale kind domain weight)</code></div><div class="doc"><div class="markdown"><p>Creates new currency record from values passed as arguments.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L66">view source</a></div></div><div class="public anchor" id="var-no-numeric-id"><h3>no-numeric-id</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Expresses the value of currency’s numeric ID which does not exist.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L29">view source</a></div></div><div class="public anchor" id="var-nr"><h3>nr</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(nr c)</code><code>(nr c registry)</code><code>(nr c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns currency numeric ID as a long number. For currencies without the assigned number it will return nil. Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L518">view source</a></div></div><div class="public anchor" id="var-ns"><h3>ns</h3><div class="usage"><code>(ns c)</code><code>(ns c registry)</code><code>(ns c locale registry)</code></div><div class="doc"><div class="markdown"><p>Alias for domain.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L590">view source</a></div></div><div class="public anchor" id="var-ns-code"><h3>ns-code</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(ns-code c)</code><code>(ns-code c registry)</code><code>(ns-code c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency code as a string for the given currency object. If the currency identifier is namespaced the namespace will be used as a prefix and slash character as a separator. Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L619">view source</a></div></div><div class="public anchor" id="var-numeric"><h3>numeric</h3><div class="usage"><code>(numeric c)</code><code>(numeric c registry)</code><code>(numeric c locale registry)</code></div><div class="doc"><div class="markdown"><p>Alias for nr.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L543">view source</a></div></div><div class="public anchor" id="var-numeric-id"><h3>numeric-id</h3><div class="usage"><code>(numeric-id c)</code><code>(numeric-id c registry)</code><code>(numeric-id c locale registry)</code></div><div class="doc"><div class="markdown"><p>Alias for nr.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L535">view source</a></div></div><div class="public anchor" id="var-of"><h3>of</h3><h4 class="type">macro</h4><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(of currency)</code><code>(of currency registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency for the given value by querying the given registry or a global registry, which may be shadowed by the value of registry/<em>default</em> (see registry/with or with-registry).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L502">view source</a></div></div><div class="public anchor" id="var-of-country"><h3>of-country</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(of-country country-id)</code><code>(of-country country-id registry)</code><code>(of-country country-id locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency for the given country identified by a country ID (which should be a keyword). If there is no currency or country of the given ID does not exist, returns nil. Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L664">view source</a></div></div><div class="public anchor" id="var-official.3F"><h3>official?</h3><div class="usage"><code>(official? c)</code><code>(official? c registry)</code></div><div class="doc"><div class="markdown"><p>Alias for iso?</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1223">view source</a></div></div><div class="public anchor" id="var-possible.3F"><h3>possible?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(possible? c)</code><code>(possible? c registry)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given value is a possible currency representation. If the registry is not given, the global one is used. By possible representation we mean that it is a currency with a keyword identifier or any other data type which can be successfully converted into such using the registry provided.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1165">view source</a></div></div><div class="public anchor" id="var-register"><h3>register</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(register registry currency)</code><code>(register registry currency country-ids)</code><code>(register registry currency update-mode?)</code><code>(register registry currency country-ids update-mode?)</code><code>(register registry currency country-ids localized-properties)</code><code>(register registry currency country-ids localized-properties update-mode?)</code></div><div class="doc"><div class="markdown"><p>Adds a currency and optional, associated country mappings and/or localized properties to the given registry. Returns updated registry.</p>
<p>The optional country-ids argument should be a sequence of keywords (however, if a single keyword is given it will be converted to a single-element sequence) with country codes which should be associated with the given currency.</p>
<p>The optional localized-properties argument should be a map of localized properties of the given currency. See the Data Structures documentation section for more information.</p>
<p>If the update mode is enabled then all of the current countries associated with the currency are removed and replaced with the provided ones. To simply add new countries, use add-countries. Also note that update mode removed localized properties so new one must be provided.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L933">view source</a></div></div><div class="public anchor" id="var-register.21"><h3>register!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(register! currency)</code><code>(register! currency country-id-or-update?)</code><code>(register! currency country-id localized-properties update?)</code></div><div class="doc"><div class="markdown"><p>Adds currency and (optional) country to the global registry. Returns updated registry. When the currency is nil, returns current state of the global, shared registry (but not a dynamic registry, even if it is set).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1026">view source</a></div></div><div class="public anchor" id="var-remove-countries"><h3>remove-countries</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(remove-countries registry country-ids)</code></div><div class="doc"><div class="markdown"><p>Removes countries from the given registry. Also unlinks constrained currencies in proper locations. Returns updated registry.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L837">view source</a></div></div><div class="public anchor" id="var-remove-countries.21"><h3>remove-countries!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(remove-countries! country-ids)</code></div><div class="doc"><div class="markdown"><p>Removes country (a keyword) or countries (seqable collection of keywords) from the global registry. Automatically removes currency constrains when necessary. Returns updated registry.</p>
<p>If the country-ids is nil, returns current state of a global registry (but not a dynamic registry, even if it is set).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1064">view source</a></div></div><div class="public anchor" id="var-remove-localized-properties"><h3>remove-localized-properties</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(remove-localized-properties registry currency-id)</code></div><div class="doc"><div class="markdown"><p>Removes localized properties assigned to a currency in a registry. Returns updated registry. Expects currency ID (or equivalent) to be passed as a second argument.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L871">view source</a></div></div><div class="public anchor" id="var-remove-localized-props.21"><h3>remove-localized-props!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(remove-localized-props! currency)</code></div><div class="doc"><div class="markdown"><p>Removes localized properties of the given currency from the global registry.</p>
<p>If the currency is nil, returns current state of a global registry (but not a dynamic registry, even if it is set).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1084">view source</a></div></div><div class="public anchor" id="var-sc"><h3>sc</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(sc c)</code><code>(sc c registry)</code><code>(sc c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns currency scale (decimal places) as an integer number. For currencies without the assigned decimal places it will return nil (the value of auto-scaled). Locale argument is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L551">view source</a></div></div><div class="public anchor" id="var-scale"><h3>scale</h3><div class="usage"><code>(scale c)</code><code>(scale c registry)</code><code>(scale c locale registry)</code></div><div class="doc"><div class="markdown"><p>Alias for sc.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L569">view source</a></div></div><div class="public anchor" id="var-set-default.21"><h3>set-default!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(set-default! c)</code></div><div class="doc"><div class="markdown"><p>Sets default currency by altering <code>*default*</code> dynamic variable.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1142">view source</a></div></div><div class="public anchor" id="var-set-default-registry.21"><h3>set-default-registry!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(set-default-registry!)</code><code>(set-default-registry! resource-path)</code><code>(set-default-registry! resource-path & more)</code></div><div class="doc"><div class="markdown"><p>Sets default, global registry using a global configuration file and optional user’s configuration file. The highlighted version of a registry will be sourced from the last configuration used.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1124">view source</a></div></div><div class="public anchor" id="var-standard.3F"><h3>standard?</h3><div class="usage"><code>(standard? c)</code><code>(standard? c registry)</code></div><div class="doc"><div class="markdown"><p>Alias for iso?</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1229">view source</a></div></div><div class="public anchor" id="var-symbol"><h3>symbol</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(symbol currency)</code><code>(symbol currency locale)</code><code>(symbol currency locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns a currency symbol as a string for the given currency object and locale. If the locale is not given, a default one is used. Uses global registry if a registry is not given.</p>
<p>The following tactic is applied:</p>
<ul>
<li>
<p>The registry field .cur-id->localized is looked up for the currency ID key. If it’s found then a key with the given locale object (a kind of java.util.Locale) is obtained. If there is no such key, the default one :* is tried (a keyword). The resulting value should be a map of localized properties in which an entry under the key :symbol should exist. Its value will be returned, if found.</p>
</li>
<li>
<p>If the above method failed and the given currency is ISO-standardized then Java methods will be tried to obtain it.</p>
</li>
</ul>
<p>A locale can be expressed as java.util.Locale object or any other object (like a string or a keyword) which can be used to look up the locale.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1391">view source</a></div></div><div class="public anchor" id="var-symbol-native"><h3>symbol-native</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(symbol-native currency)</code><code>(symbol-native currency registry)</code></div><div class="doc"><div class="markdown"><p>Like symbol but for ISO-standardized currencies uses locale assigned to the first country where a currency is the default. When locale is given it is ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1430">view source</a></div></div><div class="public anchor" id="var-unregister"><h3>unregister</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(unregister registry currency)</code></div><div class="doc"><div class="markdown"><p>Removes a currency from the given registry. Also removes country and numeric ID constrains when necessary and all localized properties associated with a currency. Returns updated registry.</p>
<p>Please note that removal of a currency which identifier and numeric identifier are the same as already registered currencies, will not only remove the existing currency identified by the ID but will also remove numeric ID from within all currency objects present in a registry.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L792">view source</a></div></div><div class="public anchor" id="var-unregister.21"><h3>unregister!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(unregister! currency)</code></div><div class="doc"><div class="markdown"><p>Removes currency from the global registry. Automatically removes country constrains when necessary and localized properties associated with a currency. Returns updated registry.</p>
<p>If the currency is nil, returns current state of a global registry (but not a dynamic registry, even if it is set).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1038">view source</a></div></div><div class="public anchor" id="var-unset-default.21"><h3>unset-default!</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(unset-default!)</code></div><div class="doc"><div class="markdown"><p>Sets default currency to nil by altering <code>*default*</code> dynamic variable.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1148">view source</a></div></div><div class="public anchor" id="var-update"><h3>update</h3><h4 class="added">added in 1.1.0</h4><div class="usage"><code>(update registry currency)</code><code>(update registry currency country-ids)</code><code>(update registry currency country-ids localized-properties-map)</code></div><div class="doc"><div class="markdown"><p>Replaces a currency in the given registry by a new one, preserving localized properties, relation to countries and code if not explicitly given. Returns updated registry. If the currency does not exist in a registry yet, it will be registered.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L996">view source</a></div></div><div class="public anchor" id="var-update.21"><h3>update!</h3><h4 class="added">added in 1.1.0</h4><div class="usage"><code>(update! currency)</code><code>(update! currency country-ids)</code><code>(update! currency country-ids localized-properties-map)</code></div><div class="doc"><div class="markdown"><p>Replaces a currency in the global, shared registry by a new one, preserving localized properties, relation to countries and code if not explicitly given. Returns updated registry. If the currency does not exist in a registry yet, it will be registered.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1013">view source</a></div></div><div class="public anchor" id="var-val-auto-scaled.3F"><h3>val-auto-scaled?</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(val-auto-scaled? scale)</code></div><div class="doc"><div class="markdown"><p>Returns true if the given scale is equal to auto-scaled.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L54">view source</a></div></div><div class="public anchor" id="var-weight"><h3>weight</h3><h4 class="added">added in 1.0.2</h4><div class="usage"><code>(weight c)</code><code>(weight c registry)</code><code>(weight c locale registry)</code></div><div class="doc"><div class="markdown"><p>Returns weight of the given currency (used to resolve conflicts when getting currencies having conflicting currency codes).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L640">view source</a></div></div><div class="public anchor" id="var-with"><h3>with</h3><h4 class="type">macro</h4><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(with currency & body)</code></div><div class="doc"><div class="markdown"><p>Sets a default currency in a lexical context of the body.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1557">view source</a></div></div><div class="public anchor" id="var-with-registry"><h3>with-registry</h3><h4 class="type">macro</h4><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(with-registry registry & body)</code></div><div class="doc"><div class="markdown"><p>Sets a registry in a lexical context of the body to be used instead of a global one in functions which require the registry and it was not passed as an argument. Has the same effect as registry/with.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/currency.clj#L1564">view source</a></div></div></div></body></html>