Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

jsonp - How to Access Yahoo Finance YQL query with historical data

I'm new to YQL. Perhaps this is very trivial, but I couldn't quite figure this out. I know, for instance, how to query current stock data from Yahoo/YQL using the YQL console:

http://developer.yahoo.com/yql/console/

with the query string:

select * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT") 

However, what if I want, say, the same data from yesterday, or a week ago? I tried things such as

select * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT") and date=20120913

But it doesn't appear to work.

Any suggestion is appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You're using the wrong table.

select * from yahoo.finance.historicaldata where symbol = "YHOO" and startDate = "2009-09-11" and endDate = "2010-03-10"

Alternatively, you could use stockretriever.py for this. In the source code, you can find a workaround for historical data.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...