Retrieving Yahoo! Finance Data using YQL

Script available here.

YQL is a query language that lets you retrieve data from across the web using an SQL-like syntax. By making a simple REST query using a standardized syntax, you can receive XML- or JSON-formatted data from a bunch of web service APIs. You can play around with YQL here.

I wrote a YQL wrapper in python which queries the Yahoo! Finance open data tables for financial data. Using this script, you can get current and historical financial info, news feeds, and options data for any ticker symbol.


import stockretriever as stocks

# Get current stock information - returns most of 
# the information on a typical Yahoo! Finance stock page
info = stocks.get_current_info(["YHOO","AAPL","GOOG","MSFT"])

# Get current stock news - returns the RSS feed for
# the given ticker in JSON format
news = stocks.get_news_feed('YHOO')

# Get historical prices - returns all historical
# open/low/high/close/volumn for thie given ticker
news = stocks.get_historical_info('YHOO')

# Get options data
options = stocks.get_options_data('YHOO')

Related Posts

A New Kind of Task Board

A kanban board with dynamic columns

Subdomains in Flask

Using subdomains to identify tenants in a multitenant Flask application

Leveraging Postgresql Schemas for Multitenancy

Segregating web application data by company using Flask and Postgresql

Time Logger for Windows 10 is Out

A time tracking app for Windows 10

Numbers Free for Windows 10 is Out

A simple block game for Windows 10

Getting All Articles Referenced in a Wikipedia Article

A bookmarklet to pull all wikipedia links from a wiki article.

Using the Google Places API

Finding Nearby Points of Interest with the Google Places API

Using the HTML5 Geolocation API

Getting a users position using the HTML5 Geolocation API

Syntactic Clustering of News Headlines

grouping together news articles by subject using tf-idf weighting

A 16-Step Sequencer in Javascript