Skip to content

Scrapes various bank websites and returns a list of currencies and and their historic rates

License

Notifications You must be signed in to change notification settings

plugintheworld/historic_bank_rates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Historic Bank Rates

Build Status

Wraps a simple scraper to retrieve the historic exchange rates. Returns the average rates for yesterday or any day specified and supported by the Central Bank of Kenya.

Install

Add this line to your application's Gemfile:

gem 'historic_bank_rates'

And then execute:

$ bundle

Or install it yourself as:

$ gem install historic_bank_rates

Usage

Initialize (NOTE: the date used can affect the success of the import! method)

scraper = HistoricBankRates::BankScrapers::CentralBankOfKenya.new
hbr = HistoricBankRates::Rates.new(scraper, Date.new(2016, 05, 30))
hbr.import! # => true

import! returns true if rates have been found. Might also throw HTTP errors. It will also return false when requesting rates for weekend days.

Update an instance's import_date and rerun the import process:

hbr.import!(Date.new(2015, 06, 30)) # => true

Retrieve a specific rate

hbr.rate('KES', 'EUR') # => 112.2322

Get all available currencies:

hbr.currencies # => ['ZAR', 'USD', 'EUR', 'RWF'… ]

Get all rates

hbr.rates # => { 'ZAR'=>6.4373, 'USD'=>100.6606, … }

Legal

The author of this gem is not affiliated with any of the banks referenced/scraped by the gem.

License

MIT, see LICENSE file

No Warranty

The Software is provided "as is" without warranty of any kind, either express or implied, including without limitation any implied warranties of condition, uninterrupted use, merchantability, fitness for a particular purpose, or non-infringement.

About

Scrapes various bank websites and returns a list of currencies and and their historic rates

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages