This repository has been archived by the owner. It is now read-only.

coin v0.2.2

currency conversion CLI

Made with Crystal Build & Test Release GitHub tag

coin: currency conversion CLI

CLI to perform currency conversions via the Fixer API.

  • Able to convert monetary values up to 168 different currencies
  • Available as a single binary, no external dependencies needed

Table of Contents

Usage

example

Help

user@host:~$ coin -h

Usage: coin [-h] [-v] amount origin <target, ...>

Positional arguments:
    amount             The amount of money to be converted
    origin             The origin currency used as base for conversion
    target             Each of the target currencies for conversion

Optional arguments:
    -h, --help         Show this help message and exit
    -v, --version      Show the program version and exit

Examples:
    $ coin 1 usd brl
    # => converts 1 us dollar to brazilian real

    $ coin 2.5 eur rub jpy
    # => converts 2.5 euro to russian rouble and japanese yen

This project is dedicated to the Public Domain (CC0).

Project page: <github.com/caian-org/coin>

For a comprehensive list of all available currencies, see docs/currencies.rst.

Fixer API token

Coin highly depends on Fixer, a "foreign exchange rates and currency conversion JSON API". Fixer gives a free tier that allows up to a 1000 requests per month. In order to get an API key and use the service, an account is required. You can sign up for a free account here.

The API key is a 32-length characters wide alphanumeric string. Coin must read this API key in order to make the request and parse it. It will, by default, try to read the key from the FIXER_API_TOKEN.

  • Export the API key:
$ export FIXER_API_TOKEN="ys1r39m5zc71xpvdjpqsnrhwqtxe98cj"

Installation

Pre-built

The pre-built binaries are available at the release page. Download the most recent version for you system, give the binary execution permissions and move to a directory on the $PATH.

# to download the macos binary, change "coin-linux" to "coin-macos"
$ wget https://github.com/caian-org/coin/releases/download/v0.2.0/coin-linux -O coin
$ chmod +x coin
$ (sudo) mv coin /usr/bin

From source

Coin is implemented in Crystal. In order to build from source you must have the Crystal compiler.

  • Clone the repository:
$ clone https://github.com/caian-org/coin
  • Make and install:
$ make
$ chmod +x coin
$ (sudo) mv coin /usr/bin

Running on Docker

  • Pull from DockerHub:
$ docker pull caian/coin
  • Run the container:
$ docker run -e FIXER_API_TOKEN="my_token" caian/coin 1 usd jpy

Alternatively, you can build the Docker image yourself:

docker build -t coin .

Contributing

Contributions are welcomed. You can contribute with bugfixes and minor features. For bigger, more complex features or architectural changes, please contact me beforehand.

If you wish to contribute:

  • Fork it (https://github.com/caian-org/coin/fork)
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

Large contributions must contain a notice stating that the owner (i.e., the contributor) waive it's copyrights to the Public Domain.

License

To the extent possible under law, Caian Ertl has waived all copyright and related or neighboring rights to this work. In the spirit of freedom of information, I encourage you to fork, modify, change, share, or do whatever you like with this project! ^C ^V

License

Repository

coin

Owner
Statistic
  • 6
  • 1
  • 0
  • 0
  • 0
  • almost 3 years ago
  • February 6, 2019
License

Creative Commons Zero v1.0 Universal

Links
Synced at

Thu, 07 Nov 2024 21:16:28 GMT

Languages