http://www.perlmonks.org?node_id=709532


in reply to Using up-to-date currency conversion rates

Thanks(++) for a really nice example of using Cache::FileCache -- exactly the kind of thing that's good to learn in general. The only thing I would add is some way to get the list of know currency abbreviations (and their full-length names), so that you could trap an unknown currency spec before sending it off to Yahoo via Finance::Quote -- and you could even show the clueless user what the available currency codes/names are.

There's bound to be some easy-to-fetch reference list for that; or maybe you could take the time to pull in the contents of http://uk.finance.yahoo.com/currency-converter, which appears to contain the full menu of available choices (hence, the set that Finance::Quote is able to service), and parse out the contents of that menu.

  • Comment on Re: Using up-to-date currency conversion rates

Replies are listed 'Best First'.
Re^2: Using up-to-date currency conversion rates
by alexm (Chaplain) on Sep 07, 2008 at 00:01 UTC
    add is some way to get the list of know currency abbreviations (and their full-length names), so that you could trap an unknown currency spec before sending it off to Yahoo via Finance::Quote

    I updated code with Locale::Currency::code2currency() checks to avoid querying Yahoo with invalid ISO 4217 codes. However, there are some valid codes that are not available either, like ADP (Andorran Peseta).

    show the clueless user what the available currency codes/names are

    The problem is that most of the 203 codes in ISO 4217 are not available via Finance::Quote, so the list would not be very accurate in terms of helping a clueless user.

    Update: fixed broken module links.

Re^2: Using up-to-date currency conversion rates
by ikegami (Patriarch) on Sep 06, 2008 at 17:33 UTC

    The only thing I would add is some way to get the list of know currency abbreviations (and their full-length names)

    Great idea. Such functionality, were it to be written , should be submitted to Finance::Quote's author for possible inclusion.

      I agree, but the only way to have the actual list of working currency codes would be to fetch them from Yahoo or any other similar site. As I said, most ISO currency codes are not usually published in financial sites, thus the currency list would have to be considered volatile.

Re^2: Using up-to-date currency conversion rates
by andreas1234567 (Vicar) on Sep 10, 2008 at 11:01 UTC
    ... currency abbreviations (and their full-length names)
    Geography::Countries does this, but it's outdated (not updated in 5 years), and attempts to contact the developer has been unsuccessful so far.

    However, there are developer releases of the same module, such as this, which could be useful. The diff between the two looks like this:

    Update: I have confused country codes with currency codes. Sorry.
    --
    No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

      AFAICS, Geography::Countries deals only with country codes, not currency abbreviations (they're different ISO standards), so I don't see how does it help.