michaelchu / optopsy

A nimble options backtesting library for Python

Home Page:https://github.com/michaelchu/optopsy/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Additional entry/exit conditions

bayareacoder opened this issue · comments

commented

Great library and very well programmed!

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

entry:

  • IV or IV/HV ratio: only enter when above a limit
  • use min/max limits on delta to choose short strike, instead of percent_otm (this would take volatility into account in setting the strike)

exit:

  • profit taker & stop loss percentages of option premium to exit: if spread decreased eg by X % vs received premium, then exit the position (take profit) or if spread increased by Y % vs received premium, then exit the position (stop loss)

Anything planned on including this?

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!