stock market (beta) doesnt work
MoonlightRay opened this issue · 6 comments
yahoo_client = YahooClient::Client.new
from Readme
YahooClient is wrong, it should be YahooFinance instead.
So.
When i do
data = yahoo_client.quotes(yahoo_client.symbols_by_market('us', 'nyse'), [:ask, :bid, :last_trade_date])
i get NoMethodError
data = yahoo_client.quotes(yahoo_client.symbols_by_market('us', 'nyse'), [:ask, :bid, :last_trade_date])
NoMethodError: undefined method `[]' for #<OpenStruct us=#<OpenStruct nasdaq=#<OpenStruct url="http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nasdaq&render=download">, nyse=#<OpenStruct url="http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nyse&render=download">, amex=#<OpenStruct url="http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=amex&render=download">>>
from /var/lib/gems/1.9.1/gems/yahoo-finance-1.0.0/lib/yahoo-finance/finance-utils.rb:21:in `symbols_by_market'
@MoonlightRay corrected the readme - can't reproduce the NoMethodError
using the example you included...
It works fine sometimes and seems that this bug depend on nasdaq apis. There is same behaviour for yahoo finance api, this one doesnt work correctly when US market is opening (in that case api give nothing).
Can you post an example where the yahoo finance api fails?
Hello,
I am also getting errors like below:
wt-wealthytrades-14111700 :007 > yahoo_client.symbols_by_market('us', 'nasd')
NoMethodError: undefined method `[]' for #<OpenStruct us=#<OpenStruct nasdaq=#<OpenStruct url="http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nasdaq&render=dow
nload">, nyse=#<OpenStruct url="http://www.nasdaq.com/screening/companies-by-name.aspx?letter=0&exchange=nyse&render=download">, amex=#<OpenStruct url="http://www.nasdaq.com/screening/c
ompanies-by-name.aspx?letter=0&exchange=amex&render=download">>>
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/yahoo-finance-1.0.0/lib/yahoo-finance/finance-utils.rb:20:in `symbols_by_market'
from (irb):7
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/railties-4.2.0/lib/rails/commands/console.rb:110:in `start'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/railties-4.2.0/lib/rails/commands/console.rb:9:in `start'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /Users/arup/iexposure/wt-wealthytrades-14111700/bin/rails:8:in `<top (required)>'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/arup/.rvm/gems/ruby-1.9.3-p551@wt/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
from /Users/arup/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/arup/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'wt-wealthytrades-14111700 :008 >
ok, the error comes because OpenStruct
lib for my Ruby version don't have #[]
method. http://ruby-doc.org/stdlib-1.9.3/libdoc/ostruct/rdoc/OpenStruct.html . I think it will be good if the information is added to the GEM, that new API supports RUBY version > 1.9.
@aruprakshit it shoud be 1.9-compatible now, fixed those references