我正在尝试获取给定符号的公司信息,并且我使用精彩的“雅虎金融”宝石获得了报价数据,但现在我需要获取公司的行业信息,而找不到方法。 / p>
有什么想法吗?
答案 0 :(得分:1)
只需将: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"