You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose of this package is to provide a convenient interface to working with exchange rates.
10
+
11
+
## Data
12
+
13
+
The data is downloaded from the European Centtral Bank, when the package is loaded.
14
+
15
+
It uses this link: <https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml>.
16
+
17
+
## Barewords
18
+
19
+
The simples interface looks like this:
20
+
21
+
```julia
22
+
julia>100EUR/DKK
23
+
745.08
24
+
```
25
+
26
+
This shows that you need 745.08 DKK to have 100 EUR.
27
+
28
+
This is done by defining and exporting variables `EUR`, `USD`, `DKK` etc (using the cool metraprogramming tools of julia).
29
+
30
+
Each variable is the exchange rate of `EUR`, so `USD` is the value of 1 USD in EUR. This means that `100USD` is the value of 100 USD in EUR.
31
+
32
+
Note that this uses the juxtaposition syntax of julia, so the can not be a whitespace between the number and the currency without an explicit multiplication:
33
+
34
+
```julia
35
+
julia>100 DKK
36
+
ERROR: syntax: extra token "DKK" after end of expression
37
+
38
+
julia>100* DKK
39
+
13.421377570193805
40
+
41
+
```
42
+
43
+
## Function interface
44
+
45
+
The package exports a single function `fromto`.
46
+
It converts from the first argument to the second argument.
47
+
48
+
```julia
49
+
julia>fromto(:EUR,:DKK)*100
50
+
745.08
51
+
```
52
+
53
+
## Unicode
54
+
55
+
The package knows a few unicode currencies:
56
+
57
+
*`€` (EUR)
58
+
*`£` (GBP)
59
+
*`¥` (JPY)
60
+
61
+
but NOT `$`, as `$` has syntactic meaning in julia (string interpolation).
0 commit comments