Issue 10464

Title
Update currency rates fails
Priority
bug
Status
resolved
Nosy list
acaubet, albertca, ced, mrichez, pokoli, reviewbot, roundup-bot, sylviegar, udono
Assigned to
ced
Keywords
review

Created on 2021-05-26.10:33:51 by albertca, last changed 3 months ago by roundup-bot.

Messages

New changeset 4d69b2cec4b4 by Cédric Krier in branch '6.0':
Convert rate values to Decimal
https://hg.tryton.org/modules/currency/rev/4d69b2cec4b4
New changeset 92c347806240 by Cédric Krier in branch 'default':
Convert rate values to Decimal
https://hg.tryton.org/tryton-env/rev/92c347806240
New changeset a7ee2b902d34 by Cédric Krier in branch 'default':
Convert rate values to Decimal
https://hg.tryton.org/modules/currency/rev/a7ee2b902d34
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-06-11.00:11:54

The release forex-python-1.6 supports the new API.
But the rates are now in string so it break module's code. Here is review348691006

Author: [hidden] (udono) Tryton translator
Date: 2021-06-08.12:26:24

I tested it successful with:

$ pip uninstall forex-python
$ pip install git+<https://github.com/MicroPyramid/forex-python.git>
Author: [hidden] (sylviegar)
Date: 2021-06-08.11:32:21

I have this message Could not fetch rates temporary when the date is before then 2021-06-01
when i put the date to 2021-06-01 i have the message
ERROR trytond.modules.currency.currency Fail to fetch rates
Traceback (most recent call last):
File "/home/slefetz/tryton/ate-dev/trytond/trytond/modules/currency/currency.py", line 381, in _update
yield from self._rates(date)
File "/home/slefetz/tryton/ate-dev/trytond/trytond/modules/currency/currency.py", line 437, in _rates
rate.rate = value.quantize(exp, rounding=rounding)
AttributeError: 'str' object has no attribute 'quantize'

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-06-07.15:07:23

The library has been updated to use a new api source . Can anyone confirm this solves the issue?

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-05-27.11:47:10
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-05-26.16:27:39

Also it does not look like forex-python is being mantained.

I do not see how this can be said with a so recent issue.

CurrencyConverter does not seem a good replacement for me because:

  • it supports less currencies
  • it does not seem to provide a list of currency code (needed for import_currencies.py script)
  • it downloads a big zip file

exchangerate.host seems too young for me and backed by a single person so we may get reliability issue on the long term (and it does not seem to have a business plan behind the service).

fixer.io is quiet similar to exchangeratesapi.io but there is no Python library so I do not see the point to create one for this service when there is already forex-python.

Maybe it's better to use daily European Central Bank rates?

There is only 30 currencies. It is the same source as CurrencyConverter so better to use the library but see the downside above.

So for me we should keep forex-python and try to collaborate to get a new version which support the new API of exchangeratesapi.io. And this also means that the fix could be backported to 6.0 series if the API key passed as environment variable.

Author: [hidden] (acaubet)
Date: 2021-05-26.11:25:41

Maybe it's better to use daily European Central Bank rates? I have been using that for long time without problems.

Author: [hidden] (mrichez)
Date: 2021-05-26.11:02:55

There's also https://fixer.io

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-05-26.10:43:45

Is it possible to customize the host used by the forex-python library?

Author: [hidden] (albertca)
Date: 2021-05-26.10:33:51

The API forex-python uses for fetching currency rates no longer works:

https://github.com/MicroPyramid/forex-python/issues/86

Also it does not look like forex-python is being mantained.

Some users report CurrencyConverter (https://pypi.org/project/CurrencyConverter/) to be working correctly but it relies in some files being downloaded: https://github.com/alexprengere/currencyconverter/blob/master/currency_converter/currency_converter.py#L41

Maybe our best bet is to use another API such as https://exchangerate.host/

History
Date User Action Args
2021-06-28 09:32:49cedlinkissue10535 superseder
2021-06-23 22:59:45roundup-botsetkeyword: - backport
messages: + msg68396
2021-06-12 10:06:38roundup-botsetmessages: + msg68229
2021-06-12 10:06:30roundup-botsetmessages: + msg68228
nosy: + roundup-bot
status: testing -> resolved
2021-06-11 00:36:43reviewbotsetmessages: + msg68198
nosy: + reviewbot
2021-06-11 00:11:54cedsetassignedto: ced
keyword: + backport, review
messages: + msg68186
reviews: 348691006
2021-06-08 12:26:24udonosetmessages: + msg68147
nosy: + udono
2021-06-08 11:32:21sylviegarsetmessages: + msg68145
nosy: + sylviegar
2021-06-07 15:07:23pokolisetmessages: + msg68130
status: chatting -> testing
2021-05-27 11:47:10pokolisetmessages: + msg67856

Showing 10 items. Show all history (warning: this could be VERY long)