-
Notifications
You must be signed in to change notification settings - Fork 20
Usage
Carlos edited this page Feb 4, 2014
·
3 revisions
The current version of stockex provides a simple Python 3+ class, YahooData, which provides easy wrapping for Yahoo! Finance API.
from stockex import stockwrapper as sw
Creating a wrapper object:
data = sw.YahooData()
Print Current data of a Stock
print(data.get_current(['GOOG']))
Print historical data of a Stock
print(data.get_historical("GOOG"))
Trivial formatting
print("Google stock: Date and Price")
for item in data.get_historical("GOOG"):
print(item['Date'] + '\t' + item['Close'])
Do a custom YQL query to Yahoo! Finance YQL API:
data.enquire('select * from yahoo.finance.quotes where symbol in ("GOOG", "C")')
Get news feed of a Company
data.get_news_feed("GOOG")
Get options data
data.get_options_info("GOOG")
Get industry ids
data.get_industry_ids()
Get industry index from a given id
data.get_industry_index('914')