如何使用 ruby 在 Yahoo 上按符号查找行业?
How do I lookup Industry by Symbol on Yahoo using ruby?
我正在尝试获取给定代码的公司信息,并且我已经使用精彩的 'yahoo-finance' gem 获取了报价数据,但现在我需要获取公司的行业信息,并且不能'找不到方法。
有什么想法吗?
只需将 :industry
添加到您要返回的字段列表中。 available_fields
为您提供完整列表。例如,
require 'yahoo_finance'
stocks = YahooFinance::Stock.new(['AAPL'], [:industry, :sector])
# use stocks.available_fields to search for the fields that you want
results = stocks.fetch; nil
results['AAPL'][:industry]
# "Electronic Equipment"
results['AAPL'][:sector]
# "Consumer Goods"
我正在尝试获取给定代码的公司信息,并且我已经使用精彩的 'yahoo-finance' gem 获取了报价数据,但现在我需要获取公司的行业信息,并且不能'找不到方法。
有什么想法吗?
只需将 :industry
添加到您要返回的字段列表中。 available_fields
为您提供完整列表。例如,
require 'yahoo_finance'
stocks = YahooFinance::Stock.new(['AAPL'], [:industry, :sector])
# use stocks.available_fields to search for the fields that you want
results = stocks.fetch; nil
results['AAPL'][:industry]
# "Electronic Equipment"
results['AAPL'][:sector]
# "Consumer Goods"