Forum OpenACS Q&A: Re: API for Currency conversion

Posted by Antonio Pisano on
I have some spare time and could have some fun implementing the feature.

Should work like this: the proc queries for a rate into a table called currency_exchange_rates. This table has 4 columns - currency_from, currency_to, exchage_rate, exchange_date.

If an entry is found, the result is returned, otherwise it is retrieved in one of this ways:
- yahoo finance if date is current date
- ECB if date is previous. As the rates are available only from Euro, the rate from different currencies would have to be derived (with possible loss of precision, yet little)

I would use this two because are free of charge, official and stable enough, but could use others if someone finds them (my searches didn't).

The rate so obtained will be then stored in table and cached.

The table could be created in the ref-currency package. The procs should go elsewhere, because the package is meant to contain only data... what could be a proper place?

This is the plan. Of course I don't want to build a cathedral in the desert, even if it would be for fun, so I will start working when I receive some feedback! :-)