brndnmtthws / thetagang

ThetaGang is an IBKR bot for collecting money
GNU Affero General Public License v3.0
1.9k stars 249 forks source link

Cap calls to set a floor on shares #322

Closed brndnmtthws closed 9 months ago

brndnmtthws commented 9 months ago

Sometimes we want to hold on to some minimum number of shares to avoid losing out on upside. To do this, we can cap the number of covered calls by setting a floor on the number of uncovered shares, which is a factor of the target number of shares.

In other words, if you set write_when.calls.cap_target_floor to 0.5, we'll always leave 50% of the target number of shares uncovered to capture upside with a bit of downside protection.

This works with write_when.calls.cap_factor, which allows you to set a cap on the total number of covered calls based on the current shares held. This helps in cases where the current number of shares exceeds the target shares, and you want to rebalance if the underlying shoots higher (i.e., allow shares to get called away).