Skip to content

API Reference

Michael Chu edited this page Oct 11, 2020 · 20 revisions

Standard Parameters

All functions defined in this page have the following common parameters:

  • data (pandas.DataFrame, required): Pandas DataFrame containing the data to generate calls strategies for
  • dte_interval (int, default: 7): An integer representing the amount of days to group by, used for "Days to Expiration"
  • max_entry_dte (int, default: 90): An integer representing the max days to expiration on entry to consider
  • exit_dte (int, default: 0): An integer representing the days to expiration on exit, defaults to exit on expiration date
  • otm_pct_interval (float, default: 0.05): A percentage numeral representing the OTM percent to group generated strategies by. (formula: (strike - underlying price) / strike)
  • max_otm_pct (float, default: 0.5): Maximum OTM percentage to consider when generating strategy
  • min_bid_ask (float, default: 0.05): The smallest bid/ask price to consider on entry. This is generally the price at which the option is considered worthless
  • drop_nan (bool, default: True): Remove rows where NaN were returned, likely due to insufficient data
  • raw (bool, default: False): Return only generated trades for the specified option strategy without grouping by dte_interval and otm_pct_interval. It's not recommend to set this parameter to True, as large amounts of trades maybe generated depending on strategy

Strategy Functions

All statistics generated from Optopsy functions below are for percentage change

Singles

optopsy.long_calls

Generates all combinations of long call strategies on the specified dataset.

optopsy.short_calls

Generates all combinations of short call strategies on the specified dataset.

optopsy.long_puts

Generates all combinations of long put strategies on the specified dataset.

optopsy.short_puts

Generates all combinations of short put strategies on the specified dataset.

Straddles

optopsy.long_straddles

Generates all valid combinations of long straddles on the specified dataset.

optopsy.short_straddles

Generates all valid combinations of short straddles on the specified dataset.

Strangles

optopsy.long_strangles

Generates all valid combinations of long strangles on the specified dataset.

optopsy.short_strangles

Generates all valid combinations of short strangles on the specified dataset.

Vertical Spreads

optopsy.long_call_spreads

Generates all valid combinations of long call spreads on the specified dataset.

optopsy.short_call_spreads

Generates all valid combinations of short call spreads on the specified dataset.

optopsy.long_put_spreads

Generates all valid combinations of long put spreads on the specified dataset.

optopsy.short_put_spreads

Generates all valid combinations of short put spreads on the specified dataset.

Clone this wiki locally