Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

  1. Outdated egg!
  2. Currency-converter
  3. Author
  4. Version
  5. Requires
  6. Usage
  7. Documentation
  8. Available currencies
  9. Examples
  10. Licence

Currency-converter

Perform currency convertion, using data from the XML feeds of the European Central Bank.

Author

Jean-Philippe Theberge

Version

1.0.0 (initial release)

Requires

Usage

(require-extension currency-converter)

Documentation

'''Procedure:''' (currency-convert FROM TO AMOUNT [#:table TABLE] [#:format? FORMAT?])

FROM and TO are symbols, AMOUNT is either a string or a number. TABLE is an alternate conversion to use, an alist of (SYMBOL . EURO-VALUE) FORMAT?, if #f, will not format the result as money (and thus return a string)

'''Variable:''' currency-converter-table

When #f (the default) the XML is retrieved and parsed from the bank at every call to currenncy-convert. When set, it's value is used as the conversion table.

'''Procedure:''' (currency-converter-table-initialize!)

Retrieve and parse current values from the bank and set currency-converter-table.

Available currencies

AUD Australian dollar
BGN Bulgarian lev
CAD Canadian dollar
CHF Swiss franc
CNY Chinese yuan renminbi
CYP Cyprus pound
CZK Czech koruna
DKK Danish krone
EEK Estonian kroon
GBP Pound sterling
HKD Hong Kong dollar
HRK Croatian kuna
HUF Hungarian forint
IDR Indonesian rupiah
ISK Icelandic krona
JPY Japanese yen
KRW South Korean won
LTL Lithuanian litas
LVL Latvian lats
MTL Maltese lira
MYR Malaysian ringgit
NOK Norwegian krone
NZD New Zealand dollar
PHP Philippine peso
PLN Polish zloty
RON New Romanian leu
RUB Russian rouble
SEK Swedish krona
SGD Singapore dollar
SKK Slovak koruna
THB Thai baht
TRY New Turkish lira
USD US dollar
ZAR South African rand

Examples

(currency-convert 'USD 'EUR 45.34)
=> "32.03"
(currency-convert 'USD 'EUR 45.34 #:format? #f)
=> 32.3003490774382
(currency-convert 'USD 'EUR 45.34 #:table '((EUR . 1)(USD . 34)))
=> "1.33"

Licence

 Copyright 2007 Jean-Philippe Theberge
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or (at
 your option) any later version.
 
 This program is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
 
 A full copy of the GPL license can be found at http://www.gnu.org/licenses/.</td>