Options - diagonal spreads (pynance.opt.spread.diag)

class pynance.opt.spread.diag.Diag(df)[source]

Wrapper class for pandas.DataFrame for retrieving metrics on horizontal (calendar) spreads

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

New in version 0.3.0.

Parameters:

df : pandas.DataFrame

Options data.

Attributes

data (pandas.DataFrame)

Methods

dblcal(lowstrike, highstrike, expiry1, expiry2)[source]

Metrics for evaluating a double calendar spread.

Parameters:

optdata : DataFrame

Data returned from get()

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

Type of option on which to collect data.

lowstrike : numeric

Lower strike price. To be used for put spread.

highstrike : numeric

Higher strike price. To be used for call spread.

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

Earlier expiration date.

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

Later expiration date.

Returns:

metrics : DataFrame

Metrics for evaluating spread.

 
diagbtrfly(lowstrike, midstrike, highstrike, expiry1, expiry2)[source]

Metrics for evaluating a diagonal butterfly spread.

Parameters:

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

Type of option on which to collect data.

lowstrike : numeric

Lower strike price. To be used for far put.

midstrike : numeric

Middle strike price. To be used for near straddle. Typically at the money.

highstrike : numeric

Higher strike price. To be used for far call.

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

Earlier expiration date.

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

Later expiration date.

Returns:

metrics : DataFrame

Metrics for evaluating spread.