Book Image

Mastering Pandas for Finance

By : Michael Heydt
Book Image

Mastering Pandas for Finance

By: Michael Heydt

Overview of this book

Table of Contents (16 chapters)
Mastering pandas for Finance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Notebook setup


The examples in this chapter will be based on the following configuration in IPython:

In [1]:
   import pandas as pd
   import numpy as np
   import pandas.io.data as web
   from datetime import datetime

   import matplotlib.pyplot as plt
   %matplotlib inline

   pd.set_option('display.notebook_repr_html', False)
   pd.set_option('display.max_columns', 7)
   pd.set_option('display.max_rows', 15) 
   pd.set_option('display.width', 82) 
   pd.set_option('precision', 3)

Options data from Yahoo! Finance

Options data can be obtained from several sources. Publicly listed options are exchanged on the Chicago Board Options Exchange (CBOE) and can be obtained from their website. Through the DataReader class, pandas also provides built-in (although in the documentation, this is referred to as experimental) access to options data.

The following command reads all currently available options data for AAPL:

In [2]:
   aapl_options = web.Options('AAPL', 'yahoo')
   aapl_options = aapl_options...