Options - options class (pynance.opt.core)

class pynance.opt.core.Options(df)[source]

Options data along with methods for easy access to desired information.

New in version 0.3.0.

Objects of this class are not intended for direct instantiation but are created by calling get()

Parameters:

df : pandas.DataFrame

Dataframe containing the options data.

Examples

Just retrieve data (no info message):

>>> geopt = pn.opt.get('ge')

or retrieve data with info:

>>> fopt, fexp = pn.opt.get('f').info()
Expirations:
...
Stock: 16.25
Quote time: 2015-03-01 16:00

Attributes

data (pandas.DataFrame) Options data.
price (Price) Wrapper containing methods for determining price.
spread (Spread) Wrapper containing methods for evaluating spreads.

Methods

exps()[source]

Index containing all expiration dates.

Returns:

expdates : pandas.tseries.index.DatetimeIndex

Index of all active expiration dates.

 
info()[source]

Show expiration dates, equity price, quote time.

Returns:

self : Options

Returns a reference to the calling object to allow chaining.

expiries : pandas.tseries.index.DatetimeIndex

Examples

>>> fopt, fexp = pn.opt.get('f').info()
Expirations:
...
Stock: 16.25
Quote time: 2015-03-01 16:00
 
quotetime()[source]

Time of quotes

Returns:qt : datetime.datetime
 
tolist()[source]

Return the array as a list of rows.

Each row is a dict of values. Facilitates inserting data into a database.

New in version 0.3.1.

Returns:

quotes : list

A list in which each entry is a dictionary representing a single options quote.