OptionCombo is a powerful library that enables the discovery of all possible option combinations for a single asset. It takes about 6 mins to compute 344k combinations
Add futures into combinations calculation ✔️
Add control to only calculate specific types of option strategy(ie iron condor, bull spread etc..) 🔲
OptionCombo currently facilitates the identification of strategies comprising one to four option combinations with the same expiry date, and now includes the capability to integrate future contracts into these combinations.
Please note that OptionCombo is designed exclusively for computation purposes. It does not include a method for downloading option data nor making financial decision for you. However, the example provided have included a function facilitates downloading and formatting data, and demostration to use this library.
OptionCombo is not yet available on PyPI. However, you can install it using the provided release file.
To begin, import the necessary modules:
from optionCombo import optionModel,preInit
To utilize the computation function, you will need option data from your preferred source. You can find a data sample in the test file, as well as an example in the example/example.ipynb file:
option_data
pricedata # price data (not necessary but used for determining the expected range)
In this step, you will need to select the expiry date and price bound for your option strategy:
expirDate = '2023-06-30T00:00:00.000000000' # e.g., choose the desired expiry date
preOption,joined1,price = preInit.Prep(expirDate, optionDf = option_data, spotPrice = spotPrice, Bound = (50, 100))
Next, input the precomputed results into the model finder. Please note that if the number of combinations exceeds 100,000, it may take a considerable amount of time to compute (approximately 960 iterations per second). The function returns a pandas DataFrame containing all the combinations based on the provided parameters. You can filter the results using the statistics provided in the DataFrame:
model = optionModel.option_model(price, joined1, preOption, optiontypes = [[1,1,1]], tradetypes=[[1,-1,1]], maxquantity=1) # Init
df = model.options_model_finder()
Finally, OptionCombo offers a method to visualize the payoff curve of the option combinations. You only need the "para" column from the resulting DataFrame:
for para in df.para[:5]:
model.model_plot(para)
For a detailed tutorial, please refer to the example file, which includes functions for collecting and formatting data. It provides a ready-to-use tutorial if you intend to trade on Deribit.
loss_extended_std: The standard deviation of the loss tail of the combination, handy when trying to find a strategy with a less sharp drop in the payoff curve.
if you are trading crypto option
you can use Greeks.live to verify the result, but its going to require a Deribit account to register. In case you get blocked by Greeks.live, as an alternate you can use Deribit position builder
Or you can use Delta Exchange, navigate to their Strategy Builder. This tool allows you to construct and visualize different options strategies.
This software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Option trading is risky and may not be suitable for all investors. Users should be aware of the risks involved and should only invest funds they can afford to lose.
The creator of this project is not responsible for any losses that users may encounter while using this software.