Skip to content

CurrencyRates conversion is not correct.  #138

Open

Description

@muhammad-grayphite

I have a usecase where I am converting VND to USD but conversion rate are not valid. for example:
Screenshot 2023-07-24 at 1 31 35 PM
Screenshot 2023-07-24 at 1 31 50 PM

These values are not even close. if library is not supporting this currency than it should not convert. please let me know if this can be fixed. I need an API/Library which can convert all the currencies to usd even the local currencies. like Google finance

Activity

  1. Cruuncher commented on Aug 2, 2023

    @Cruuncher

    Going from VND to USD I get an error, not a number:

    Python 3.11.4 (main, Jun 20 2023, 16:59:59) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from forex_python.converter import CurrencyRates
    >>> c = CurrencyRates()
    >>> c.convert('VND', 'USD', 1)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.11/site-packages/forex_python/converter.py", line 108, in convert
        raise RatesNotAvailableError("Currency Rates Source Not Ready")
    forex_python.converter.RatesNotAvailableError: Currency Rates Source Not Ready
    
  2. janosspaits commented on Aug 25, 2023

    @janosspaits

    I have noticed the same thing today with GBP to EUR. It broke yesterday. 2 days ago it was the correct 1.16, now it's 0.126 or something which is completely off.

    from forex_python.converter import *
    from datetime import datetime, timedelta
    
    yesterday = datetime.now() - timedelta(days=1)
    now = datetime.now()
    c = CurrencyRates()
    start_currency='GBP'
    end_currency='EUR'
    money = 1.0
    result = c.get_rate(base_cur=start_currency, dest_cur=end_currency, date_obj=yesterday) * money
    
    print(result)
    

    this prints out 0.13268758707622902

    even more interestingly if you use convert instead of get_rate, it gets you the correct amount

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions