Options - remote retrieval (pynance.opt.retrieve)

pynance.opt.retrieve.get(equity, showinfo=True)[source]

Retrieve all current options chains for given equity.

Parameters:

equity : str

Equity for which to retrieve options data.

showinfo : bool, optional

If true (default), available expiries and equity price are printed to console.

Returns:

optdata : DataFrame

All options data for given equity currently available from Yahoo! Finance.

expdates : pandas.tseries.index.DatetimeIndex

Index of all active expiration dates.

eqprice : float

Price of underlying equity at the time options data was retrieved.

Notes

For convenience, expiration dates are shown by default. So you don’t have to call other functions to figure out what the exact expiration dates are for the various options you might be considering. An index of the expiration timestamps is also returned, so that you can then pass dates not only in the form ‘2015-08-21’ (or other object are formats that pandas can convert to timestamps) but also as a numerical index in pandas timeseries (cf. example below).

To disable this feature and return a single dataframe of options data, set the showinfo argument to False.

Examples

>>> fopt, fexp, feq = pn.opt.get('f')
Expirations:
...
>>> fstraddle = pn.opt.spread.straddle(fopt, 16, fexp[4])
pynance.opt.retrieve.getexpiries(optdata)[source]

Get all expiration dates contained in the data index.

Parameters:

optdata : DataFrame

Collection of options data as retrieved from pn.opt.get()

Returns:

expdates : pandas.tseries.index.DatetimeIndex

Index of all active expiration dates.

pynance.opt.retrieve.showexpiries(optdata)[source]

Show all expiration dates but return nothing

Parameters:

optdata : DataFrame

Collection of options data as retrieved from pn.opt.get()

Previous topic

Options - price (pynance.opt.price)

Next topic

Options - spreads (pynance.opt.spread)

This Page