Forum OpenACS Q&A: Re: API for Currency conversion
I'll have a look at those references you posted.
I also found something on google APIs.
The one I really liked, and thought it was very good to emphasize here, came form European Central Bank.
I believe that one we could have more confidence!
It's a webservice where you can grab an xml file with daily quotations.
Pretty and neat! Check it out.
If interested I can send it to you.
Being a common feature request in web applications, we could think about writing a little wrapper, based on this and/or other official webservices and populate a standard table...
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!