Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > yahoo finance api:Timeout::Error: execution expired

Thread Tools

yahoo finance api:Timeout::Error: execution expired

Pen Ttt
Posts: n/a
i want to download usa stock quote data via ruby-yahoo finance api,
here is my program:
require 'rubygems'
require 'yahoofinance'
while line=file1.gets
print line," ",i,"\n"
YahooFinance::get_historical_quotes( line,
Date.parse( '2005-09-09' ), ) do |row|
file2.puts "#{line},#{row.join(',')}"

there are 6000 companies in the file1 ,each company one line ,i use "i"
to count company,the program can run,but each time i can only download
about ten companies data,the output is

Timeout::Error: execution expired
from /usr/lib/ruby/1.8/timeout.rb:60:in `rbuf_fill'
from /usr/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
from /usr/lib/ruby/1.8/net/protocol.rb:86:in `read'
from /usr/lib/ruby/1.8/net/http.rb:2236:in `read_chunked'
from /usr/lib/ruby/1.8/net/http.rb:2211:in `read_body_0'
from /usr/lib/ruby/1.8/net/http.rb:2177:in `read_body'
from /usr/lib/ruby/1.8/net/http.rb:773:in `get'
from /usr/lib/ruby/1.8/net/http.rb:1053:in `request'
from /usr/lib/ruby/1.8/net/http.rb:2140:in `reading_body'
from /usr/lib/ruby/1.8/net/http.rb:1052:in `request'
from /usr/lib/ruby/1.8/net/http.rb:772:in `get'
from /usr/lib/ruby/1.8/net/http.rb:543:in `start'
from /usr/lib/ruby/1.8/net/http.rb:440:in `start'
from (irb):10
from :0irb(main):016:0>
what's wrong??
Posted via

Reply With Quote
Brian Candler
Posts: n/a
Pen Ttt wrote:
> i want to download usa stock quote data via ruby-yahoo finance api,
> here is my program:

I don't know anything about the Yahoo Finance API, but I know that if I
were running such a public service, I would probably include some
protection against one person trying to hit it 6000 times repeatedly.
Are you sure you're using the right API call to do what you want?

OTOH, a quick search suggests that Yahoo rate limiting is typically done
over a larger period:

Anyway, I'd suggest you try the following:

(1) Re-order the list of companies you search. Does it always barf on
the same one, or always the 10th in the list?

(2) Insert a "sleep 1" into the loop, see if the problem goes away

(3) Check that the YahooFinance client module is properly closing each
socket, by using "netstat -n" in another window, and checking how many
sockets are in ESTABLISHED state. If there are lots of ESTABLISHED
sockets then the client code isn't closing sockets, and the server may
have a limit on the number of concurrent requests from the same IP.
Posted via

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mainstream Digital Chooses the BroadSoft Platform to Provide Next Generation Fixed-Mobile Voice Services to SMEs in ... (Market Wire via Yahoo! Finance) UK VOIP 0 02-19-2007 03:02 PM
Affiliated Computer Inks $14M Deal (AP via Yahoo! Finance) Computer Information 0 02-13-2007 07:02 AM
Spot Future Trends and Developments in the Recorded DVD & Video Market in the United Kingdom (Business Wire via Yahoo! Finance) DVD Video 0 02-12-2007 08:02 AM
finance yahoo technology Java 1 01-23-2005 05:42 PM
script to download Yahoo Finance data dan roberts Python 13 07-06-2004 10:17 PM