34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
from dataclasses import dataclass
|
|
|
|
from .option_spread_strategy import OptionSpreadStrategy
|
|
from .option_type import OptionType
|
|
|
|
@dataclass
|
|
class DeltaTargetStrategy(OptionSpreadStrategy):
|
|
delta_target: float
|
|
|
|
def iron_condor_strategy(delta_target: float) -> str:
|
|
return f'{int(delta_target * 100)} Delta Iron Condor'
|
|
|
|
def create_strategies(delta_target: float, entry_time: str, number_of_contracts: int = 1):
|
|
call_spread_strategy = DeltaTargetStrategy(
|
|
delta_target = delta_target,
|
|
option_type = OptionType.CALL,
|
|
number_of_contracts = number_of_contracts,
|
|
spread_width = 50,
|
|
stop_loss_multiple = 1.00,
|
|
trade_entry_time = entry_time,
|
|
entry_slippage = 0.10,
|
|
exit_slippage = 0.20
|
|
)
|
|
put_spread_strategy = DeltaTargetStrategy(
|
|
delta_target = -delta_target,
|
|
option_type = OptionType.PUT,
|
|
number_of_contracts = number_of_contracts,
|
|
spread_width = 50,
|
|
stop_loss_multiple = 1.00,
|
|
trade_entry_time = entry_time,
|
|
entry_slippage = 0.10,
|
|
exit_slippage = 0.20
|
|
)
|
|
return call_spread_strategy, put_spread_strategy |