Skip to content

Qjawko/currency-convertor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Currency Convertor CLI

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.

Features

  • Convert between different currencies.
  • Utilizes real-time exchange rates from the CoinMarketCap API.
  • Graceful shutdown to handle interruptions.

Prerequisites

  • Go (at least version 1.19)
  • A valid CoinMarketCap API key

Installation

  1. Clone this repository:

    git clone https://github.com/qjawko/currency-convertor.git
  2. Navigate to the project directory:

    cd currency-convertor
  3. Build the project:

    make
  4. The binary will be available in ./build/bin.

Configuration

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

Usage

./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

Examples

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

Contributing

If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.

License

This project is open-source and available under the MIT License.

Acknowledgments

  • Thanks to CoinMarketCap for providing the currency conversion API.