Retrieving options data from Google Finance

Pandas provides experimental support for Google Finance Options data to be retrieved via the Options class. In the following example, the .get_all_data() method is used to download options data for AAPL from Google:

With this result, it is possible to determine the expiration dates by using the .expiry_dates property:

The actual data is read using .get_options_data():

The resulting DataFrame object contains a hierarchical index which can be used to easily extract specific subsets of data. To demonstrate, let's examine several examples of slicing by the values using the index.

The following will return all the put options at a Strike price of $30. Using slice(None) as one of the values in the tuple used to select by index will include all Expiry dates:

We can narrow the date range by specifying a date slice instead of slice(None). The following narrows the results down to those where the Expiry date is between 2015-01-17 and 2015-04-17:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset