Closed
Description
Lots of examples are requesting yahoo finance, but this api is discontinued by Yahoo.
so the following examples doesn't work for newbies. Could you please replace yahoo?
Many thanks.
require 'concurrent'
require 'thread' # for Queue
require 'open-uri' # for open(uri)
class Ticker
def get_year_end_closing(symbol, year)
uri = "http://ichart.finance.yahoo.com/table.csv?s=#{symbol}&a=11&b=01&c=#{year}&d=11&e=31&f=#{year}&g=m"
puts uri
data = open(uri) {|f| f.collect{|line| line.strip } }
data[1].split(',')[4].to_f
end
end
Reference
https://forums.yahoo.net/t5/Yahoo-Finance-help/Is-Yahoo-Finance-API-broken/td-p/250503
URI
http://ichart.finance.yahoo.com/table.csv?s=TWTR&a=11&b=01&c=2013&d=11&e=31&f=2013&g=m