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 Function List

All statistics generated from Optopsy functions below are for percentage change.

Singles

optopsy.long_calls

optopsy.short_calls

optopsy.long_puts

optopsy.short_puts

Straddles

optopsy.long_straddles

optopsy.short_straddles

Strangles

optopsy.long_strangles

optopsy.short_strangles

Vertical Spreads

optopsy.long_call_spreads

optopsy.short_call_spreads

optopsy.long_put_spreads

optopsy.short_put_spreads