Options - price (pynance.opt.price)

class pynance.opt.price.Price(df)[source]

Wrapper class for pandas.DataFrame for retrieving options prices.

Objects of this class are not intended for direct instantiation but are created as attributes of objects of type Options.

New in version 0.3.0.

Parameters:

df : pandas.DataFrame

Options data.

Attributes

data (pandas.DataFrame) Options data.

Methods

exps(opttype, strike)[source]

Prices for given strike on all available dates.

Parameters:

opttype : str (‘call’ or ‘put’)

strike : numeric

Returns:

df : pandas.DataFrame

eq : float

Price of underlying.

qt : datetime.datetime

Time of quote.

See also

strikes()

 
get(opttype, strike, expiry)[source]

Price as midpoint between bid and ask.

Parameters:

opttype : str

‘call’ or ‘put’.

strike : numeric

Strike price.

expiry : date-like

Expiration date. Can be a datetime.datetime or a string that pandas can interpret as such, e.g. ‘2015-01-01’.

Returns:

out : float

Examples

>>> geopts = pn.opt.get('ge')
>>> geopts.price.get('call', 26., '2015-09-18')
0.94
 
metrics(opttype, strike, expiry)[source]

Basic metrics for a specific option.

Parameters:

opttype : str (‘call’ or ‘put’)

strike : numeric

Strike price.

expiry : date-like

Expiration date. Can be a datetime.datetime or a string that pandas can interpret as such, e.g. ‘2015-01-01’.

Returns:

out : pandas.DataFrame

 
strikes(opttype, expiry)[source]

Retrieve option prices for all strikes of a given type with a given expiration.

Parameters:

opttype : str (‘call’ or ‘put’)

expiry : date-like

Expiration date. Can be a datetime.datetime or a string that pandas can interpret as such, e.g. ‘2015-01-01’.

Returns:

df : pandas.DataFrame

eq : float

Price of underlying.

qt : datetime.datetime

Time of quote.

See also

exps()