This application has CLI and API. The exchange rates are obtained through the European Central Bank every day.
Here's the list of currency codes we this app support https://www.exchangerate-api.com/docs/supported-currencies
Here's more about the web API utilizad https://www.exchangerate-api.com/
- Python =< 3
- click
- flask
- flask-restful
- json
amount
- amount to convert - Support to float numbersinput_currency
- input currency - Currency Code or Currency Symboloutput_currency
- requested/output currency - Currency Code or Currency Symbol
Obs: When the exit currency is not declared, it is converted to the entire known currency.
-
Clone the project
-
Access the
app
folder:$ cd app
-
Execute the
$ pip3 install -r requirements.txt
$ python3 app/api.py
$ ./currency_converter.py --amount <float|int> --input_currency <string> --output_currency <string>
--amount
accepts only float or integers--input_currency
accepts 3 letters strings or currency symbols--output_currency
accepts 3 letters strings or currency symbols (optional)
{
"input": {
"amount": <float>,
"currency": <Currency Code>
}
"output": {
<Currency Code>: <float>
}
}
./currency_converter.py --amount 100.0 --input_currency EUR --output_currency CZK
{
"input": {
"amount": 100.0,
"currency": "EUR"
},
"output": {
"CZK": 2707.36,
}
}
./currency_converter.py --amount 0.9 --input_currency ¥ --output_currency AUD
{
"input": {
"amount": 0.9,
"currency": "JPY"
},
"output": {
"AUD": 0.01
}
}
./currency_converter.py --amount 10.92 --input_currency £
{
"input": {
"amount": 10.92,
"currency": "GBP"
},
"output": [
{
"AUD": 20.24,
"BGN": 24.4,
"BRL": 56.53,
.
.
}
]
}
GET /currency_converter?amount=0.9&input_currency=au$&output_currency=brl HTTP/1.1
{
"input": {
"amount": 0.9,
"currency": "AUD"
},
"output": {
"BRL": 2.51
}
}
GET /currency_converter?amount=0.9&input_currency=CA$&output_currency= HTTP/1.1
{
"input": {
"amount": 0.9,
"currency": "CAD"
},
"output": [
{
"AUD": 0.97,
"BGN": 1.17,
"BRL": 2.71,
.
.
.
}
}
}