You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
@GustavoCaso try to call #value! instead of value it will give you an error happening in get_year_end_closing. The error is there even with the puts added. Btw the example does not need to use the same API you can do something with GitHub API or anything else if you like.
Activity
pitr-ch commentedon Nov 18, 2017
Thanks, we'll fix it.
GustavoCaso commentedon Nov 18, 2017
I'm going to have a look at this one 😄
pitr-ch commentedon Nov 18, 2017
Thanks, @GustavoCaso!
pitr-ch commentedon Jul 6, 2018
@GustavoCaso are you still looking into this? If not please let me know.
GustavoCaso commentedon Jul 6, 2018
Hey @pitr-ch, first of all, thank you for the invite. Sorry for the huge delay swamp with work and other contributions. But count with me for this one
pitr-ch commentedon Jul 6, 2018
Ok great, I've assigned it to you.
GustavoCaso commentedon Jul 6, 2018
Thanks
GustavoCaso commentedon Jul 21, 2018
@pitr-ch I started working on fixing the examples but got stack when the example works only if I
putsthe row when parsing it.Here is a gist with the example and a comment, any feedback is very welcome https://gist.github.com/GustavoCaso/862139e82718341db4cfb00ea8720f2e
pitr-ch commentedon Aug 2, 2018
Thanks for looking at it, sorry I missed your comment. The gist example works for me without
putsadded, how does it fail for you?GustavoCaso commentedon Aug 8, 2018
@pitr-ch If I run it multiple times there is no output, maybe the first time it is, but later there is no output
pitr-ch commentedon Aug 15, 2018
@GustavoCaso try to call
#value!instead ofvalueit will give you an error happening inget_year_end_closing. The error is there even with the puts added. Btw the example does not need to use the same API you can do something with GitHub API or anything else if you like.pitr-ch commentedon Aug 15, 2018
Just got to looking at your PR :)
chrisseaton commentedon Mar 14, 2022
Fixed in #937.