Update ISO 4217 currency data for ISO 4217 amendment number 171.

This commit is contained in:
Chris Berkhout 2022-04-04 13:04:26 +02:00
parent aceb0f09d1
commit 7a9d3d3e8f
3 changed files with 16 additions and 5 deletions

View file

@ -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

View file

@ -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():

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ISO_4217 Pblshd="October 1, 2021">
<ISO_4217 Pblshd="2022-04-01">
<CcyTbl>
<CcyNtry>
<CtryNm>AFGHANISTAN</CtryNm>
@ -1493,6 +1493,13 @@
<CcyNbr>694</CcyNbr>
<CcyMnrUnts>2</CcyMnrUnts>
</CcyNtry>
<CcyNtry>
<CtryNm>SIERRA LEONE</CtryNm>
<CcyNm>Leone</CcyNm>
<Ccy>SLE</Ccy>
<CcyNbr>925</CcyNbr>
<CcyMnrUnts>2</CcyMnrUnts>
</CcyNtry>
<CcyNtry>
<CtryNm>SINGAPORE</CtryNm>
<CcyNm>Singapore Dollar</CcyNm>