Open
Description
I have written a python script for converting EUR to USD and GBP to USD based on today's value using python package forex_python, but I am getting incorrect conversion rates for both.
Here is my code -
from forex_python.converter import CurrencyRates
from datetime import datetime
Get the current date in the format "YYYY-MM-DD"
current_date = datetime.now().strftime("%Y-%m-%d")
Define the currency pairs
from_currency = 'GBP'
to_currency_usd = 'USD'
to_currency_eur = 'EUR'
Initialize the CurrencyRates object
c = CurrencyRates()
Fetch the exchange rates for today
y = c.get_rate(from_currency, to_currency_usd)
z = c.get_rate(to_currency_eur, to_currency_usd)
I am getting EUR to USD as 0.27 whereas today's value is 1.07
I am getting GBP to USD as 1.27 whereas today's value is 1.25
Any solution for it?
Metadata
Metadata
Assignees
Labels
No labels