YahooFinance

未知
Ruby
跨平台
2009-04-01
红薯

YahooFinance是一个从finance.yahoo.com获得股市信息的Ruby模块。它可以获取股票数据和历史数据。它能作为一个类库使用,也可以通过命令行调用。

安装方法:gem install yahoofinance

使用方法:

require 'yahoofinance'

# Set the type of quote we want to retrieve.
# Available type are:
# - YahooFinanace::StandardQuote
# - YahooFinanace::ExtendedQuote
# - YahooFinanace::RealTimeQuote
quote_type = YahooFinance::StandardQuote

# Set the symbols for which we want to retrieve quotes.
# You can include more than one symbol by separating
# them with a ',' (comma).
quote_symbols = "yhoo,goog"

# Get the quotes from Yahoo! Finance. The get_quotes method call
# returns a Hash containing one quote object of type "quote_type" for
# each symbol in "quote_symbols". If a block is given, it will be
# called with the quote object (as in the example below).
YahooFinance::get_quotes( quote_type, quote_symbols ) do |qt|
puts "QUOTING: #{qt.symbol}"
puts qt.to_s
end


# You can get the same effect using the quote specific method.
quotes = YahooFinance::get_standard_quotes( quote_symbols )
quotes.each do |symbol, qt|
puts "QUOTING: #{symbol}"
puts qt.to_s
end
加载中

评论(0)

暂无评论

暂无资讯

暂无问答

雅虎财经和新浪财经股票API,中国A股实时和历史数据API获取

本文介绍Yahoo财经频道和新浪财经频道获取股票数据的股票API。可以通过此股票API获取实时数据。

2015/12/10 19:25
354
0

没有更多内容

加载失败,请刷新页面

没有更多内容

返回顶部
顶部