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

Collapse
Posted by Antonio Pisano on
I have some working code into a proc we used some time ago which queried that same webservice. It uses tdom to extract exchange rates and load them in the db.

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...

Collapse
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! 😊