michaelchu / optopsy

A nimble options backtesting library for Python
https://github.com/michaelchu/optopsy/wiki
GNU General Public License v3.0
1k stars 160 forks source link

Additional entry/exit conditions #57

Closed bayareacoder closed 3 years ago

bayareacoder commented 3 years ago

Great library and very well programmed!

To evaluate some strategies, especially selling spreads, it would be useful to have additional entry & exit conditions:

entry:

exit:

Anything planned on including this?

michaelchu commented 3 years ago

Hi @bayareacoder,

thank you for your comments!

To answer your question, at the moment the library is designed to be "dumb" and evaluates the options from start to end without any conditions. One way around this, is to determine the entry and exit dates (with conditions) manually from outside the program and then feed only the dates that needs to be tested, as shown here. It's not very user friendly at the moment, let me know if you need help with this.

As for limits on delta, the library was originally built to use only delta instead of pct_otm. However, I favoured pct_otm for reasons that I forgot now, I will consider adding it back as an option. If you think you can navigate the code to implement it feel free to send a PR request :)

Contributions welcomed!