From f3c99b3aa0d09f133958f58a7b0cb1ba8d4be753 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Wed, 21 Feb 2024 08:50:32 -0800 Subject: [PATCH] Ensure that entry slippage is always a positive number --- iron_condor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iron_condor.py b/iron_condor.py index 4c08435..085693d 100644 --- a/iron_condor.py +++ b/iron_condor.py @@ -165,7 +165,7 @@ def _enter_iron_condor(entry_time: datetime): {'Action': 'BUY', 'Strike': long_call_strike, 'Type': 'CALL'} ], 'Open': call_spread_fill, - 'Entry Slippage': round(call_spread_fill - call_spread_mid, 3) + 'Entry Slippage': round(call_spread_mid - call_spread_fill, 3) } put_spread_details = { @@ -174,7 +174,7 @@ def _enter_iron_condor(entry_time: datetime): {'Action': 'BUY', 'Strike': long_put_strike, 'Type': 'PUT'} ], 'Open': put_spread_fill, - 'Entry Slippage': round(put_spread_fill - put_spread_mid, 3) + 'Entry Slippage': round(put_spread_mid, put_spread_fill, 3) } upsert(pd.DataFrame([{