Home

Awesome

YFi

Build Status

Yahoo! YQL library with tools focusing on the finance portion (eventually).

Description

YFi allows you to create and run queries against Yahoo's YQL datatables.

It is currently in the beginning stages and supports the following YQL statments:

You can also set YQL variables, the following of which are supported:

The plan is to also provide tools to use specifically with the finance tables.

Usage

The following is a example that returns all the data from the yahoo.finance.quotes table for the symbols 'TSLA' and 'GOOG'

from yfi.yql import Yql
# create a Yql object
y = Yql()
# this object supports chaining so we can build our query in one line. select() defaults to '*'
y.select().where('symbol')._in('TSLA', 'GOOG')
# the exec() method returns a json object unless format has been changed otherwise
j = y.run()

The following is a shortcut for the above. It will select('*') from whatever table is set (default: yahoo.finance.quotes) for the given symbol(s)

from yfi.yql import Yql
y = Yql()
y.symbol('TSLA', 'GOOG')
j = y.run()

Upcoming Features

Running Tests

To run all tests: python -m unittest discover

To run just Yql: python -m unittest test.TestYql