From 50269972aebb44715b5f1605f106e7a7d53d2c75 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Sun, 10 Mar 2024 05:23:26 -0700 Subject: [PATCH] Add entry and exit slippage to option spread strategies so that they can ultimately be configured by the client --- backtesting/credit_targeting.py | 8 ++++++-- backtesting/delta_targeting.py | 8 ++++++-- backtesting/option_spread_strategy.py | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/backtesting/credit_targeting.py b/backtesting/credit_targeting.py index a0ca7ca..b75416b 100644 --- a/backtesting/credit_targeting.py +++ b/backtesting/credit_targeting.py @@ -17,7 +17,9 @@ def create_strategies(credit_target: float, entry_time: str, number_of_contracts number_of_contracts = number_of_contracts, spread_width = 50, 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( 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, spread_width = 50, 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 \ No newline at end of file diff --git a/backtesting/delta_targeting.py b/backtesting/delta_targeting.py index 381f42b..23e2470 100644 --- a/backtesting/delta_targeting.py +++ b/backtesting/delta_targeting.py @@ -17,7 +17,9 @@ def create_strategies(delta_target: float, entry_time: str, number_of_contracts: number_of_contracts = number_of_contracts, spread_width = 50, 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( 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, spread_width = 50, 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 \ No newline at end of file diff --git a/backtesting/option_spread_strategy.py b/backtesting/option_spread_strategy.py index 9a75511..e5c2f68 100644 --- a/backtesting/option_spread_strategy.py +++ b/backtesting/option_spread_strategy.py @@ -8,4 +8,6 @@ class OptionSpreadStrategy: number_of_contracts: int spread_width: int stop_loss_multiple: float - trade_entry_time: str \ No newline at end of file + trade_entry_time: str + entry_slippage: float + exit_slippage: float \ No newline at end of file