2024-01-17 19:37:37 +00:00
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
from .option_spread_strategy import OptionSpreadStrategy
|
2024-02-04 13:56:28 +00:00
|
|
|
from .option_type import OptionType
|
2024-01-17 19:37:37 +00:00
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class CreditTargetStrategy(OptionSpreadStrategy):
|
2024-02-04 13:56:28 +00:00
|
|
|
credit_target: float
|
|
|
|
|
2024-02-15 16:18:15 +00:00
|
|
|
def iron_condor_strategy(credit_target: float) -> str:
|
|
|
|
return f'${credit_target:.2f} Iron Condor'
|
|
|
|
|
2024-02-04 13:56:28 +00:00
|
|
|
def create_strategies(credit_target: float, entry_time: str, number_of_contracts: int = 1):
|
|
|
|
call_spread_strategy = CreditTargetStrategy(
|
|
|
|
credit_target = credit_target,
|
|
|
|
option_type = OptionType.CALL,
|
|
|
|
number_of_contracts = number_of_contracts,
|
|
|
|
spread_width = 50,
|
|
|
|
stop_loss_multiple = 1.00,
|
2024-03-10 12:23:26 +00:00
|
|
|
trade_entry_time = entry_time,
|
|
|
|
entry_slippage = 0.10,
|
|
|
|
exit_slippage = 0.20
|
2024-02-04 13:56:28 +00:00
|
|
|
)
|
|
|
|
put_spread_strategy = CreditTargetStrategy(
|
|
|
|
credit_target = credit_target,
|
|
|
|
option_type = OptionType.PUT,
|
|
|
|
number_of_contracts = number_of_contracts,
|
|
|
|
spread_width = 50,
|
|
|
|
stop_loss_multiple = 1.00,
|
2024-03-10 12:23:26 +00:00
|
|
|
trade_entry_time = entry_time,
|
|
|
|
entry_slippage = 0.10,
|
|
|
|
exit_slippage = 0.20
|
2024-02-04 13:56:28 +00:00
|
|
|
)
|
|
|
|
return call_spread_strategy, put_spread_strategy
|