Closed (duplicate)
Project:
Currency
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jul 2011 at 09:50 UTC
Updated:
10 Nov 2011 at 21:18 UTC
Hi all,
Thanks for the great module. Use it quite extensively for calculating prices on my websites. Sadly, Yahoo seems to be not as reliable as usual the last few days returning things like:
currency 18/07/2011 - 11:15 currency: 1 CNY = 1 EUR
currency 18/07/2011 - 11:15 currency: 1 USD = 505570816 EUR
Checked the code for caching a little while, but it seems there is no mechanism to prevent bad data to be used. Could we make something like; "only update to new rate if difference with old rate is < 20%"?
Would anybody be interested in that?
Thanks
Mark
Comments
Comment #1
norbert.banfi commentedI have the same problem too.
This prevent mechanism would be so cool. (Unless the old rate is 1 or 505570816)
Comment #2
panoskop.net commentedI am having the same issue
Comment #3
mollyow commentedSame issue here.
Comment #4
karengrey commentedsame here too. On friday the Yen was screwed up. Today its Euros.
Need a fix ASAP!
Comment #5
alan d. commentedWell this is not a bug in the module, but there should be safe guards for this. There would be issues with say the Zimbabwe Dollar as inflation has hit 10 Million + %, so the threshold would be constantly hit. Luckily for this currency, external currencies are mainly used now that appear to be keeping the depreciated dollar in check...
Comment #6
info@handmadeIT commentedHmm, i recently refiled this bug as critical (which had been removed) because using the module on a productive e-commerce-site definitly screws up the system and freaks out the customers.
Do you know what exactly the problem is? Does Yahoo delivers wrong data?
My idea was to define a threshold where the admin or another user with sufficient rights has to approve the new currency exchange rate.
Comment #7
alan d. commentedI'm totally refactoring the module for a new 7.x-2.x branch. If this gets accepted, then the safeguard built into this version can be easily backported to the older 7.x-1.x / 6.x-1.x branches too. I really dislike the results from Yahoo, it was the least accurate and produced strange results on pegged currencies - returning 0.0 instead of 1.0 for example.
So the issue is that Yahoo produces
a) randomly bad results
b) bad results for pegged currencies
This is the solution from the 7.x-2.x version that I'm working on is:
We store base conversions to the USD of every currency in the DB, so we always have a base rate to compare to. This is editable via the UI and updated via cron.
And there are two other built in currency exchange rate providers; Google calculator and the ECB currency feed. The EU bank gives daily rates for 30 or so main currencies and the Google calculator covers most of the currencies with better precision than Yahoo. However, the Google lookup is based on an un-documented API that should not be used excessively and should not be used on commercial sites.
I wrote a xe.com rates scraper for myself in 9 lines of code which is the default on my test site and this is working great. But, I can not add this as it is against the TNT of xe.com. If I can get access to a feed / api key, then I'm happy to write a plugin for any commercial exchange rates web service.
Issues with back-porting this is that currently there is no way to validate against an old rate if it does not already exist in the currencies cache table. My timeline is to try and finish this today, and then it is up to the maintainers to accept, tidy up, or reject this new code base and test. I can not give a timeline on this process, and then potentially back-port to a 6.x-2.x branch.
Comment #8
alan d. commentedHi Guys,
Testers and reviews needed for #1219512: New branch & API. Both for Drupal 6 and Drupal 7 versions.
1) This has 3 exchange rate providers, and it is easy to write a scraper for other services.
2) It has base rate conversions with the USD stored in the db, so ABC to XYZ should always return a result
3) It has a safe guard margin, from 5% to 200% for new lookups.
4) More caching options
And heaps more.
This represents about 4 days programming and it is a complete rewrite of the currency_api module INCLUDING an updated API.
So backup / test on test sites only.
The API has changed, so read the README for details or ping me for help. Report issues to the other thread.
Cheers
Comment #9
amateescu commentedAs @Alan D. said in #8, work on alternative currency exchange providers is happening in #1219512: New branch & API so I'm closing this issue as a duplicate in order to concentrate the focus over there.