A simple command-line currency converter written in Python. It fetches live exchange rates from the freecurrencyapi.com API and converts a base currency into 20 major world currencies.
USD, EUR, GBP, JPY, AUD, CAD, CHF, CNY, SEK, NZD, MXN, SGD, HKD, NOK, KRW, TRY, INR, RUB, BRL, ZAR
-
Clone this repo:
git clone https://github.com/<your-username>/currency-converter-cli.git cd currency-converter-cli
-
Create and activate a virtual environment (optional but recommended):
python -m venv .venv source .venv/Scripts/activate # Windows (Git Bash) # or source .venv/bin/activate # macOS/Linux
-
Install dependencies:
pip install -r requirements.txt
-
Get a free API key from freecurrencyapi.com, then open
currency_converter.pyand replace the placeholder:API_KEY = "YOUR_API_KEY_HERE"
Run the script:
python currency_converter.pyYou'll be prompted to enter a base currency code (e.g. USD), and it will print the converted value in all supported currencies. Type q to quit.
- The free tier of freecurrencyapi.com supports a limited set of currencies (does not currently include NGN or GHS).
- Never commit your real API key to GitHub. Keep it out of version control (see
.gitignore).