fx-calculator

⚖️ Simple command line tool for currency rate conversion

FX-Calculator CI Releases License

Simple command line tool for calculating foreign exchange rates.

Installation

git clone https://github.com/crystal-money/fx-calculator.git
cd fx-calculator

shards install
shards build --release

Usage

[!NOTE] Available rate providers can be found at https://github.com/crystal-money/money/tree/master/src/money/currency/rate_provider.

Get a currency exchange rate between EUR and USD, using the FloatRates provider.

./bin/fx-calculator -p FloatRates 'EUR to USD'

Convert 200 USD to PLN (by providing the currency inline), using the FloatRates provider.

./bin/fx-calculator -p FloatRates '$200 in PLN'
./bin/fx-calculator -p FloatRates '$200 to PLN'

Convert 200 USD and 430 EUR to PLN (by setting the default currency), using the FloatRates provider.

./bin/fx-calculator -p FloatRates -C PLN '$200' '430 EUR'

You can use a configuration file (-c /path/to/config.yml) instead of providing options through the command line:

rate_store:
  name: File
  options:
    filepath: ~/.cache/fx-calculator/currency-rates.json
    ttl: 15 minutes

rate_provider:
  name: Compound
  options:
    providers:
      - name: FloatRates
      - name: UniRateAPI
        options:
          api_key: your-api-key

currency: EUR

To see all available options run ./bin/fx-calculator --help.

Contributing

  1. Fork it (https://github.com/crystal-money/fx-calculator/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

fx-calculator

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 2
  • about 16 hours ago
  • August 25, 2025
License

MIT License

Links
Synced at

Wed, 10 Sep 2025 01:32:34 GMT

Languages