Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
ENH: Added method to pandas.data.Options to download all option data for... #5602
| @@ -52,6 +52,43 @@ Yahoo! Finance | ||
| f=web.DataReader("F", 'yahoo', start, end) | ||
| f.ix['2010-01-04'] | ||
| +.. _remote_data.yahoo_Options: | ||
| + | ||
| +Yahoo! Finance Options | ||
| +---------------------- | ||
| +***Experimental*** | ||
| + | ||
| +The Options class allows the download of options data from Yahoo! Finance. | ||
| + | ||
| +The ''get_all_data'' method downloads and caches option data for all expiry months | ||
jorisvandenbossche
Owner
|
||
| +and provides a formatted ''DataFrame'' with a hierarchical index, so its easy to get | ||
| +to the specific option you want. | ||
| + | ||
| +.. ipython:: python | ||
| + | ||
| + from pandas.io.data import Options | ||
| + aapl = Options('aapl', 'yahoo') | ||
| + data = aapl.get_all_data() | ||
jreback
Contributor
|
||
| + data.head() | ||
| + | ||
| + #Show the $600 strike puts at all expiry dates: | ||
| + data.loc[(600, slice(None), 'put'),:].head() | ||
| + | ||
| + #Show the volume traded of $600 strike puts at all expiry dates: | ||
| + data.loc[(600, slice(None), 'put'),'Vol'].head() | ||
| + | ||
| +If you don't want to download all the data, more specific requests can be made. | ||
| + | ||
| +.. ipython:: python | ||
| + | ||
| + import datetime | ||
| + expiry = datetime.date(2016, 1, 1) | ||
| + data = aapl.get_call_data(expiry=expiry) | ||
| + data.head() | ||
| + | ||
| +Note that if you call ''get_all_data'' first, this second call will happen much faster, as the data is cached. | ||
| + | ||
| + | ||
| .. _remote_data.google: | ||
jreback
Contributor
|
||
| Google Finance | ||
This should be moved to v0.14.1.txt (or removed if it is already there)