Add entry and exit slippage to option spread strategies so that they can ultimately be configured by the client

This commit is contained in:
moshferatu 2024-03-10 05:23:26 -07:00
parent 37c3ebe1fa
commit 50269972ae
3 changed files with 15 additions and 5 deletions

View File

@ -17,7 +17,9 @@ def create_strategies(credit_target: float, entry_time: str, number_of_contracts
number_of_contracts = number_of_contracts, number_of_contracts = number_of_contracts,
spread_width = 50, spread_width = 50,
stop_loss_multiple = 1.00, stop_loss_multiple = 1.00,
trade_entry_time = entry_time trade_entry_time = entry_time,
entry_slippage = 0.10,
exit_slippage = 0.20
) )
put_spread_strategy = CreditTargetStrategy( put_spread_strategy = CreditTargetStrategy(
credit_target = credit_target, credit_target = credit_target,
@ -25,6 +27,8 @@ def create_strategies(credit_target: float, entry_time: str, number_of_contracts
number_of_contracts = number_of_contracts, number_of_contracts = number_of_contracts,
spread_width = 50, spread_width = 50,
stop_loss_multiple = 1.00, stop_loss_multiple = 1.00,
trade_entry_time = entry_time trade_entry_time = entry_time,
entry_slippage = 0.10,
exit_slippage = 0.20
) )
return call_spread_strategy, put_spread_strategy return call_spread_strategy, put_spread_strategy

View File

@ -17,7 +17,9 @@ def create_strategies(delta_target: float, entry_time: str, number_of_contracts:
number_of_contracts = number_of_contracts, number_of_contracts = number_of_contracts,
spread_width = 50, spread_width = 50,
stop_loss_multiple = 1.00, stop_loss_multiple = 1.00,
trade_entry_time = entry_time trade_entry_time = entry_time,
entry_slippage = 0.10,
exit_slippage = 0.20
) )
put_spread_strategy = DeltaTargetStrategy( put_spread_strategy = DeltaTargetStrategy(
delta_target = -delta_target, delta_target = -delta_target,
@ -25,6 +27,8 @@ def create_strategies(delta_target: float, entry_time: str, number_of_contracts:
number_of_contracts = number_of_contracts, number_of_contracts = number_of_contracts,
spread_width = 50, spread_width = 50,
stop_loss_multiple = 1.00, stop_loss_multiple = 1.00,
trade_entry_time = entry_time trade_entry_time = entry_time,
entry_slippage = 0.10,
exit_slippage = 0.20
) )
return call_spread_strategy, put_spread_strategy return call_spread_strategy, put_spread_strategy

View File

@ -9,3 +9,5 @@ class OptionSpreadStrategy:
spread_width: int spread_width: int
stop_loss_multiple: float stop_loss_multiple: float
trade_entry_time: str trade_entry_time: str
entry_slippage: float
exit_slippage: float