I need to get the latest currency rates from ECB for USD/EUR and CHF/EUR. What is the recommended method?
Version 1: Tried pandasdmx but do not know the most efficient way to extract the value:
ecb = sdmx.Request("ECB")
parameters = {
"startPeriod": "2021-12-29",
"endPeriod": "2021-12-29",
}
data_response = ecb.data(
resource_id="EXR",
key={"CURRENCY": ["CHF", "USD"]},
params=parameters,
)
How do I parse the data_response to get the values for USD and CHF?
Version 2: An alternative way I found was to access
request_url = "https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"
Parsing the XML is easy but the first version seems to be the more updated one.
Any thoughts?