Related to this page containing all the requirements.
A program that converts user input value from one currency into another into a
JSON
file.
The currency converter takes a date, value and your desired input and output
currencies in an infinite loop. In order to exit the app you just need to type
end
. After typing end
you'll get a few additional prompts telling you to
save your file in output/conversions.json
and if there's already a saved file
from there then you can choose to:
-
Write to a new file (only in
output/
). -
Override the existing file.
-
Discard your changes.
In the case where you want to use today's date, there's a neat shorthand for
the --date
/ -d
command with an alias of now
. With it you can use today's
date without having to type it out like this:
python3 CurrencyConversion.py --date=now
# or
python3 CurrencyConversion.py -d=now
# Trailing/leading quotes don't affect it either
python3 CurrencyConversion.py -d="now"
# It's also case-insensitive
python3 CurrencyConversion.py -d="nOw"
Head to FastForex and make an account for an API key.
Add the API key in a config.json
file in the root of this repository. The
file format should be like this
{
"fast_forex_api_key": "your-key-here | check out https://console.fastforex.io/auth/signin"
}
It's necessary for the variable to be called fast_forex_api_key
.
Additionally you need to install requests if you haven't already. You can do it in 2 ways (i recommend using the requirements.txt one).
pip install -r requirements.txt # NOTE: in the project root.
# Or
pip install requests
Then it's a manner of running the app.
python3 CurrencyConversion.py -d=YYYY-MM-DD
# or
python3 CurrencyConversion.py --date=YYYY-MM-DD
Replace the YYYY-MM-DD
part with the year-month-day you wish to do your
currency conversion in.
Note
Free accounts are limited to 14 days back in time and their service works for dates after 2015-01-01.