Currency Convertor is a command-line interface (CLI) tool that allows users to convert between different currencies using the latest exchange rates provided by the CoinMarketCap API.
- Convert between different currencies.
- Utilizes real-time exchange rates from the CoinMarketCap API.
- Graceful shutdown to handle interruptions.
- Go (at least version 1.19)
- A valid CoinMarketCap API key
-
Clone this repository:
git clone https://github.com/qjawko/currency-convertor.git
-
Navigate to the project directory:
cd currency-convertor
-
Build the project:
make
-
The binary will be available in
./build/bin
.
Before you can use the Currency Convertor CLI, you need to provide your CoinMarketCap API key.
You can configure it using an environment variable:
- Environment variable:
export CMC_API_KEY=YOUR_COINMARKETCAP_API_KEY
./currency-convertor <amount> <from_currency> <to_currency>
<amount>
: The amount of currency you want to convert.<from_currency>
: The currency code of the currency you want to convert from.<to_currency>
: The currency code of the currency you want to convert to.
For help:
./currency-convertor help
To convert 100 US Dollars to Euros:
./currency-convertor 100 USD EUR
To convert 1500 Japanese Yen to US Dollars:
./currency-convertor 1500 JPY USD
If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.
This project is open-source and available under the MIT License.
- Thanks to CoinMarketCap for providing the currency conversion API.