Giter VIP home page Giter VIP logo

coin's Introduction

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

coin's People

Contributors

upsetbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rfesi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.