Utilize configurable entry and exit slippages provided by the client via the option spread strategies
This commit is contained in:
parent
50269972ae
commit
4532e2499f
@ -111,12 +111,12 @@ def _backtest_iron_condor(
|
||||
|
||||
# Calculate entry slippage.
|
||||
if original_call_spread_price > 0.05:
|
||||
original_call_spread_price = original_call_spread_price - 0.10
|
||||
original_call_spread_price = original_call_spread_price - call_spread_strategy.entry_slippage
|
||||
original_call_spread_price -= (original_call_spread_price % 0.05)
|
||||
logging.info('Original Call Spread Price: %s', original_call_spread_price)
|
||||
|
||||
if original_put_spread_price > 0.05:
|
||||
original_put_spread_price = original_put_spread_price - 0.10
|
||||
original_put_spread_price = original_put_spread_price - put_spread_strategy.entry_slippage
|
||||
original_put_spread_price -= (original_put_spread_price % 0.05)
|
||||
logging.info('Original Put Spread Price: %s', original_put_spread_price)
|
||||
|
||||
@ -184,8 +184,7 @@ def _backtest_iron_condor(
|
||||
if current_call_spread_price >= ((call_spread_strategy.stop_loss_multiple + 1) * original_call_spread_price):
|
||||
premium_received -= original_call_spread_price * (call_spread_strategy.stop_loss_multiple + 1)
|
||||
call_spread_details['Close'] = original_call_spread_price * (call_spread_strategy.stop_loss_multiple + 1) + 0.10
|
||||
# Calculate exit slippage.
|
||||
premium_received -= 0.20 # TODO: Make this configurable.
|
||||
premium_received -= call_spread_strategy.exit_slippage
|
||||
call_spread_stopped_out = True
|
||||
exit_time = call_spread.name[-8:]
|
||||
logging.info('Call Spread Stopped Out')
|
||||
@ -193,7 +192,7 @@ def _backtest_iron_condor(
|
||||
if not put_spread_stopped_out:
|
||||
if current_put_spread_price >= ((put_spread_strategy.stop_loss_multiple + 1) * original_put_spread_price):
|
||||
premium_received -= original_put_spread_price * (put_spread_strategy.stop_loss_multiple + 1)
|
||||
premium_received -= 0.20 # TODO: Make this configurable.
|
||||
premium_received -= put_spread_strategy.exit_slippage
|
||||
put_spread_details['Close'] = original_put_spread_price * (put_spread_strategy.stop_loss_multiple + 1) + 0.10
|
||||
put_spread_stopped_out = True
|
||||
exit_time = call_spread.name[-8:]
|
||||
|
Loading…
Reference in New Issue
Block a user