| require 'csv' | |
| # Cheers to Greg on StackOverflow | |
| # http://stackoverflow.com/questions/181990/programmatically-access-currency-exchange-rates | |
| class Yahoo | |
| def self.fetch(code = 'AUDUSD') | |
| csv = `curl -q "http://download.finance.yahoo.com/d/quotes.csv?s=#{code}=X&f=sl1d1t1ba&e=.csv"` | |
| values = CSV.parse(csv) | |
| values[0][1] | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment