FxFetcher

FxFetcher is a gem that calculates the fx rate for a currency pair eg. EUR/USD. There is a basic demo at http://knox-fx.herokuapp.com/ to show how you could use it.

Installation

Add this line to your application's Gemfile:

gem 'fx_fetcher'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fx_fetcher

Usage

FxFetcher is currently quite basic and requires a model to be set up like so:

t.date :rate_date
t.string :base_currency
t.string :counter_currency
t.decimal :rate

In your model type include FxFetcher and the following commands are available:

ModelName.at(Date.today,'GBP','USD') to calculate the fx rate

ModelName.currencies to get a list of possible currencies

ModelName.valid_amount?(amount) to check if amount is non text and greater than zero

I plan to turn this into a Rails engine that will automate the setup of a database by just requiring the command ``rake db:migrate

Contributing

  1. Fork it ( https://github.com/[my-github-username]/fx_fetcher/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