Skip to content

examples are broken due to Yahoo #670

Closed

Description

@xiaoronglv

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

Activity

  1. pitr-ch commented on Nov 18, 2017

    @pitr-ch
    Member

    Thanks, we'll fix it.

  2. added this to the milestone on Nov 18, 2017
  3. GustavoCaso commented on Nov 18, 2017

    @GustavoCaso
    Contributor

    I'm going to have a look at this one 😄

  4. pitr-ch commented on Nov 18, 2017

    @pitr-ch
    Member

    Thanks, @GustavoCaso!

  5. assigned and unassigned on Nov 18, 2017
  6. pitr-ch commented on Jul 6, 2018

    @pitr-ch
    Member

    @GustavoCaso are you still looking into this? If not please let me know.

  7. added
    pendingWaiting for response, blocked by other problem, etc.
    on Jul 6, 2018
  8. GustavoCaso commented on Jul 6, 2018

    @GustavoCaso
    Contributor

    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

  9. pitr-ch commented on Jul 6, 2018

    @pitr-ch
    Member

    Ok great, I've assigned it to you.

  10. removed
    pendingWaiting for response, blocked by other problem, etc.
    on Jul 6, 2018
  11. GustavoCaso commented on Jul 6, 2018

    @GustavoCaso
    Contributor

    Thanks

  12. removed this from the milestone on Jul 6, 2018
  13. GustavoCaso commented on Jul 21, 2018

    @GustavoCaso
    Contributor

    @pitr-ch I started working on fixing the examples but got stack when the example works only if I puts the 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

  14. pitr-ch commented on Aug 2, 2018

    @pitr-ch
    Member

    Thanks for looking at it, sorry I missed your comment. The gist example works for me without puts added, how does it fail for you?

  15. GustavoCaso commented on Aug 8, 2018

    @GustavoCaso
    Contributor

    @pitr-ch If I run it multiple times there is no output, maybe the first time it is, but later there is no output

  16. pitr-ch commented on Aug 15, 2018

    @pitr-ch
    Member

    @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.

  17. pitr-ch commented on Aug 15, 2018

    @pitr-ch
    Member

    Just got to looking at your PR :)

  18. chrisseaton commented on Mar 14, 2022

    @chrisseaton
    Member

    Fixed in #937.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

choreGem maintenance tasks.medium-priorityShould be done soon.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions