Created
August 25, 2015 02:56
-
-
Save niltonvasques/72936a81546d3234c3fa to your computer and use it in GitHub Desktop.
Update investments quotes in a libreoffice spreadsheet using ruby and yahoo finances gem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'yahoo-finance' | |
| stocks = ["PETR3.SA"] | |
| yahoo_client = YahooFinance::Client.new | |
| data = yahoo_client.quotes( stocks, [:close]) | |
| File.open("quotes.csv", "w+") do |file| | |
| stocks.size.times do |x| | |
| file.puts "\"#{stocks[x]}\",#{data[x].close}" | |
| end | |
| end | |
| exec("libreoffice --calc -o Investimentos.ods") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment