MicroPyramid / forex-python

Foreign exchange rates, Bitcoin price index and currency conversion using ratesapi.io
http://forex-python.readthedocs.io/en/latest/usage.html
MIT License
662 stars 197 forks source link

Converting to EUR #99

Closed midnightkali closed 2 years ago

midnightkali commented 3 years ago

from forex_python.converter import CurrencyRates

amount = 5 c = CurrencyRates()

eur = c.get_rate("EUR", "PHP") amount_eur = eur * amount

print(type(amount_eur)) print(amount_eur)

output - <class 'str'> 59.34259.34259.34259.34259.342

it returns a string not a float

abbyjng commented 3 years ago

It seems like this issue is within the the Forex API. When requesting from them with EUR as the base, they return a string for those rates, but a float with any other base. Most likely this issue should be addressed there instead of in this codebase, but it could be fixed here as well. For reference, here is the API.

abbyjng commented 3 years ago

This should be resolved now via this issue and commit.

ashwin31 commented 2 years ago

@midnightkali let me know if you find any issues.