Skip to content

A python tool that retrieves official exchange rates from Lietuvos Bankas for dates given in stdin

Notifications You must be signed in to change notification settings

turbonaitis/lb-conversion-rate-retriever

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

What is this?

This is a small Python script that will retrieve official currecy exchange rates from the Bank of Lithuania, which you can also manually retrieve here. At the moment, it returns USD/EUR rate.

Running the tool

Install dependencies

$ python -m venv env
$ source env/bin/activate
$ pip install -r requirements.txt

Execute

The script takes the list of dates (separated by new line) in the format of YYYY-MM-dd. They can either be read from stdin

$ echo "2020-05-20
2020-03-01
2020-01-01
2018-03-22" | python main.py

or you can pass a file name with dates as the first argument

python main.py /tmp/dates

The script will then write exchange rates in the same order to stdout

1,095
1,0977
1,1234
1,2286

NOTE: the decimal separator used by The Bank of Lithuania is "," and I didn't bother changing it. If you need other decimal separators - just use sed

python main.py /tmp/dates | sed s/,/./

About

A python tool that retrieves official exchange rates from Lietuvos Bankas for dates given in stdin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages