Currency Converter

CMP home Downloads Menu no menu Last updated 2004-06-28 by Roedy Green ©2002-2004 Canadian Mind Products.

Introduction

FX stands for Foreign Exchange. CurrCon stands for Currency Converter.

The currency converter lets you display prices/amounts in the native currency of the visitors to your website. The currency converter automatically selects the default currency to display based on the locale country setting of the browser. It currently supports 169 different currencies.

Unlike most currency converters, with this one, the user does not enter amounts to be converted. The values come from your web page. All prices on your web pages are instantly displayed in the user's favourite currency without him having to do anything.

Benefits

It lets you sell to an international market on the web. You quote prices in your native currency, and CurrCon deals with automatically converting all the prices on a page to the user's favoured currency. If the user wants, he can flip all the prices on the page instantaneously into any other currency.

If you write essays that mention amounts of money, you can use CurrCon so that all these amounts are automatically converted to the currency the reader is most familiar with. That ensures your readers fully understand what you are saying.

How It Works

Unlike most currency converters, this one requires no server-side support. It does not require JavaScript. However, it does require Java in the user's browser. Each value displayed is a tiny Java Applet. All that is required is you upload the currcon.jar file to your website. It contains the latest exchange rates in compressed form and also the Java code to do the conversions.

If you change the currency choice anywhere on a page, automatically all the other displays on the page instantly follow suit. Try using the up down arrow to cycle through the possible currencies. Try it below:

$0.00 USD

To get a display like this:

$70.00 USD

You need to code some HTML that looks like this:

<!-- macro CurrCon C$AcN USD 70.00 -->

which expands to:

<applet archive="currcon.jar" code="com.mindprod.currcon.CurrCon.class" width="280" height="20" alt="70.00 USD">
<param name="currency" value="USD">
<param name="amount" value="70.00">
<param name="show" value="C$AcN">
</applet>

Normally you might display something simpler such as this:

$70.00 USD

To get that you code some HTML like this:

<!-- macro CurrCon cA USD 70.00 -->
which expands to this:
<applet archive="currcon.jar" code="com.mindprod.currcon.CurrCon.class" width="120" height="20" alt="70.00 USD">
<param name="currency" value="USD">
<param name="amount" value="70.00">
<param name="show" value="cA">
</applet>
or even simpler like this:

$70.00 USD

To get that you code some HTML like this:

<!-- macro CurrCon A USD 70.00 -->
which expands to this:
<applet archive="currcon.jar" code="com.mindprod.currcon.CurrCon.class" width="70" height="20" alt="70.00 USD">
<param name="currency" value="USD">
<param name="amount" value="70.00">
<param name="show" value="A">
</applet>

Details of the Applet Tags

Typically to produce a CurrCon display, you need something like this in your HTML:
<applet archive="currcon.jar" code="com.mindprod.currcon.CurrCon.class" width="120" height="20" alt="70.00 USD">
<param name="currency" value="USD">
<param name="amount" value="70.00">
<param name="show" value="cA">
</applet>
What is all this gobbledgook? Happily most of it is just boilerplate. You can copy/paste standard templates and just change the amount.

Details of the show Parameter

Letter What it looks like Changeable Width in Pixels Purpose
c $0.00 USD yes 50 Allows user to change the currency for all displays on the page.
C $0.00 USD no 30 Compactly let's user know what currency is being used with a three-letter abbreviation.
N $0.00 USD no 120 Spells out the currency name being used in easy-to-understand words.
A $70.00 USD no 70 Show the amount, converted into the users's favoured currency. If there is no A in the show parameter, you need not bother specifying the currency and amount parameters.
$ $70.00 USD no 10 Put a lead $/euro symbol etc. on the following amount.
You can use any combination of the letters c C N A $, in any order, leaving any out. You need to add up the widths of each piece an put that in as the width of the entire Applet. Unfortunately currCon can't add them up for you, since by the time it starts the amount of screen real estate is already fixed. For example:

Yuchh, that's too Complicated!

Don't give up yet. There are several possible alternatives to manually coding the <APPLET tags.

Displaying Exchange Rates

You can also use CurrCon to display exchange rates like this:

1 Euro is €1.00 EUR $0.00 USD
1 British pound Sterling is 1.00 GBP
1 US dollar is $1.00 USD
1 Canadian dollar is $1.00 CAD
1 New Zealand dollar is 1.00 NZD

Updates

Exchange rates change daily. I update the exchange rate tables daily and post them on my website. You are free to download the latest versions every day and upload them to your website. Alternatively, you can use your own source and add the massaged serialized data to the jar yourself. I have written code to do this the Bank of Canada, the source I use on my own website. I could write you an automated extractor for other sources. Most likely I would charge $50.00 USD , but it depends on the complexity. In any case, I give you a fixed price ahead of time. It is not hard to do yourself using the two sample extractors I have written as models.

FX Sources

You need to pick a source for your exchange rates.
Foreign Exchange Rate Currency Sources
Source Number Of Currencies Format Notes
Bank Of Canada 55 CSV downloadable file, very convenient. Relative to Canadian dollar. Official Government source, comes out 1 PM EST each day. Has last 7 days of rates. This is the source I use at mindprod.com. Free. You can also pick them up indirectly already massaged into a jar file from the mindprod.com website each day.
oanda.com 167 Requires licencing the feed. Makers of the FxCommerce product that competes with CurrCon. It is illegal to use this site to feed data into CurrCon by screenscaping or copying from the screen. Their lawyer explained this in series of emails. Apparently, it would be legal if either you or I signed a licence agreement with them and paid a fee to use a special feed they have.

If you curious about the history of how the US dollar (code USD) has been doing relative to the Canadian dollar (code USD), the Euro (code EUR) even the Iraqi Dinar (code IQD) see Oanda's fxhistory. The US dollar is in deep trouble, but most Americans are unaware of what is happening. Money is fleeing America causing the value of the dollar to drop relative to other countries. The net effect is America has to pay more for imported goods which puts her still deeper in debt in a vicious spiral of debt.

Bank Of Montreal 62 HTML table screenscrape listed with both country and currency.
Univerity of BC 44 HTML table screenscrape Updated each noon Pacific Time
US Federal Reserve Bank 25 text in columns screenscrape Official government source.
CustomHouse 26 HTML table screenscrape rates are one day behind.
Microsoft 15 HTML table screenscrape Updated frequently
XE.com 68 as an email in columns surrounded by extraneous text. Email would need to be extracted manually when it arrived.
newspaper ? you type them in daily using a csv file. This is a lot of work. It is error prone. The main advantage is no issue of paying royalties.

Comparision of CurrCon with Oanda FxCommerce

Oanda makes a similar product to CurrCon called FXCommerce.
Feature CurrCon FxCommerce
Requires special Code on the server? no yes
Automatically selects user's currency yes no
Requires user to have JavaScript enabled no yes
Requires user to have Java enabled yes no
Requires user to reload page to see prices? no yes
Lets you control font, color etc. of prices with style sheets? no yes
Cost $70.00 USD
one time fee.
$40.00 USD
per month.

Configuring

The program is slightly customised for your website. I need to ask you a few questions. This protects you from pirates pounding your website to provide them with CurrCon services. I am opening to creating custom versions of the program as well. I need to know which technique you will use to generate the Applet tags and what source you plan to use for the exchange rates. To help you get started quickly, I need to know which currency choices you want to offer.
currency for the possible choices.
The list of choices is limited by both what your source offers and by the list of currency descriptions. A currency must be in both lists to show up on the web page. The currency details list looks like this, with columns for abbreviation, decimal places, unicode currency symbol, description:

view

Costs

All prices are in $0.00 USD , but of course, you now know how to change that.

$70.00 USD for the Currency Converter and coaching you through installation and your first few web pages. See details on how to buy it. The price includes source, and your right to modify it and use it throughout your company.

buying CurrCon ¤ currency ¤ Currency Converter Student Project


CMP logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 5290.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/zips/java/currcon.html J:\mindprod\zips\java\currcon.html