Skip to content

API Reference

Michael Chu edited this page Oct 6, 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
  • side (str, default: "long"): The side of the strategy to return in the output, can be either"long" or "short".
  • drop_nan (bool, default: True): Remove rows where NaN were returned, likely due to insufficient data
  • raw (bool, default: False): Return generated trades without grouping by dte_interval and otm_pct_interval. Use this flag to return trades for the specified option strategy only. It's not recommend to set this parameter to True, as large amounts of trades maybe generated depending on strategy

optopsy.single_calls

Generates all combinations of call strategies on the specified dataset.

Expected runtimes on Macbook Pro 15-inch, Mid 2015, Quad-core i7, 2.2Ghz, 16Gb Ram:

  • CSV file size 65MB with default parameters: ~7 secs

optopsy.single_puts

Generates all combinations of put strategies on the specified dataset.

Expected runtimes on Macbook Pro 15-inch, Mid 2015, Quad-core i7, 2.2Ghz, 16Gb Ram:

  • CSV file size 65MB with default parameters: ~7 secs

optopsy.straddles

Generates all valid combinations of straddles on the specified dataset.

Expected runtimes on Macbook Pro 15-inch, Mid 2015, Quad-core i7, 2.2Ghz, 16Gb Ram:

  • CSV file size 65MB with default parameters: ~10 secs

optopsy.strangles

Generates all valid combinations of strangles on the specified dataset.

Expected runtimes on Macbook Pro 15-inch, Mid 2015, Quad-core i7, 2.2Ghz, 16Gb Ram:

  • CSV file size 65MB with default parameters: ~13 secs
Clone this wiki locally