From 7a9d3d3e8f2cc13b144629e7bc3d49bf980c01d0 Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Mon, 4 Apr 2022 13:04:26 +0200 Subject: [PATCH] Update ISO 4217 currency data for ISO 4217 amendment number 171. --- Makefile | 7 +++++++ src/pricehist/isocurrencies.py | 5 +---- src/pricehist/resources/list_one.xml | 9 ++++++++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 83c4c2c..eb13631 100644 --- a/Makefile +++ b/Makefile @@ -39,3 +39,10 @@ pre-commit: ## Checks to run before each commit .PHONY: tox tox: ## Run tests via tox poetry run tox + +.PHONY: fetch-iso-data +fetch-iso-data: ## Fetch the latest copy of the ISO 4217 currency data + wget -O src/pricehist/resources/list_one.xml \ + https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list_one.xml + wget -O src/pricehist/resources/list_three.xml \ + https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/list_three.xml diff --git a/src/pricehist/isocurrencies.py b/src/pricehist/isocurrencies.py index 550db3a..fe02678 100644 --- a/src/pricehist/isocurrencies.py +++ b/src/pricehist/isocurrencies.py @@ -24,7 +24,6 @@ Functions: """ from dataclasses import dataclass, field -from datetime import datetime from importlib.resources import read_binary from typing import List @@ -45,9 +44,7 @@ class ISOCurrency: def current_data_date(): one = etree.fromstring(read_binary("pricehist.resources", "list_one.xml")) - pblshd = one.cssselect("ISO_4217")[0].attrib["Pblshd"] - date = datetime.strptime(pblshd, "%B %d, %Y").date().isoformat() - return date + return one.cssselect("ISO_4217")[0].attrib["Pblshd"] def historical_data_date(): diff --git a/src/pricehist/resources/list_one.xml b/src/pricehist/resources/list_one.xml index 7bc46c2..0e8dd7a 100644 --- a/src/pricehist/resources/list_one.xml +++ b/src/pricehist/resources/list_one.xml @@ -1,5 +1,5 @@ - + AFGHANISTAN @@ -1493,6 +1493,13 @@ 694 2 + + SIERRA LEONE + Leone + SLE + 925 + 2 + SINGAPORE Singapore Dollar