Packages

Simple FX rates library for Elixir

Current section

Files

Jump to
fx lib fx.ex
Raw

lib/fx.ex

defmodule Fx do
alias Fx.Rates
@moduledoc """
Fx is a client to fetch the latest foreign exchange rates.
It is a thin wrapper around [Fixer.io](http://fixer.io/)
"""
def convert(amount, source_currency, target_currency) when amount >= 0.0 do
amount
|> Rates.from(source_currency)
|> Rates.to(target_currency)
end
end