Options - price (pynance.opt.price)

pynance.opt.price.allexpiries(optdata, opttype, strike)[source]

Prices for given strike on all available dates.

Parameters:

optdata : DataFrame

opttype : str {‘call’, ‘put’}

strike : numeric

Returns:

df : DataFrame

eq : float

Price of underlying.

qt : datetime.datetime

Time of quote.

pynance.opt.price.allstrikes(optdata, opttype, expiry)[source]

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

Parameters:

optdata : DataFrame

opttype : str {‘call’, ‘put’}

expiry : date or date str

Returns:

df : DataFrame

eq : float

Price of underlying.

qt : datetime.datetime

Time of quote.

pynance.opt.price.get(optdata, opttype, strike, expiry, showtimeval=True)[source]

Retrieve price and time value of an option.

Parameters:

optdata : DataFrame

Data returned from pn.opt.get()

opttype : str {‘call’, ‘put’}

Type of option on which to collect data.

strike : numeric

Strike price.

expiry : date or date str (e.g. ‘2015-01-01’)

Expiration date.

showtimeval : bool, optional

Whether or not to include time value calculation. Setting this value to false will save time if the function is potentially being used inside a loop. Defaults to True.

Returns:

opt : float

Price of option (midpoint between bid and ask).

eq : float

Price of underlying.

qt : datetime.datetime

Time of quote.

tv : float, optional

Time value of option. Returned only as long as showtimeval is set to True.

Previous topic

Options - covered calls (pynance.opt.covcall)

Next topic

Options - remote retrieval (pynance.opt.retrieve)

This Page