From 80edd6fa026c4c1aa64baaead57a02f271e495b4 Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Mon, 24 May 2021 20:51:32 +0200 Subject: [PATCH] Use ISO currency names in ECB --symbols output. --- src/pricehist/sources/ecb.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pricehist/sources/ecb.py b/src/pricehist/sources/ecb.py index 0c6bf3a..054d1cd 100644 --- a/src/pricehist/sources/ecb.py +++ b/src/pricehist/sources/ecb.py @@ -1,9 +1,10 @@ from datetime import datetime, timedelta from decimal import Decimal -from lxml import etree import requests +from lxml import etree +from pricehist import isocurrencies from pricehist.price import Price @@ -33,7 +34,8 @@ class ECB: root = etree.fromstring(data) nodes = root.cssselect("[currency]") currencies = sorted(set([n.attrib["currency"] for n in nodes])) - pairs = [f"EUR/{c}" for c in currencies] + iso = isocurrencies.bycode() + pairs = [f"EUR/{c} Euro against {iso[c].name}" for c in currencies] return pairs def fetch(self, pair, type, start, end):